1
class CreatingWindowForEachLesson():
    def __init__(self,root,t,d1,d2,d3):
        self.t=t
        self.root=root
        self.root.focus_set()
        self.root.title(self.t)
        self.lesson=BooleanVar()
        self.l=Label(self.root,text=self.t,bg='blue') #ΤΟΜΕΑΣ ΣΠΟΥΔΑΣΤΗ 
        self.l.pack()
        self.frame1=Frame(self.root) #ΤΙΤΛΟΣ ΜΑΘΗΜΑΤΟΣ
        self.frame1.pack(anchor="center",side="top", fill="both", expand=True)
        self.frame=Frame.__init__(self)
        self.canvas =Canvas(root, borderwidth=0, background="#ffffff")
        Frame.__init__(self,self.canvas)
        Label(self,text="FirstColBot",width=30).grid(row=0,column=0)            
        Label(self,text="SecndColBot",width=20).grid(row=0,column=1)
        self.canvas = Canvas(root, borderwidth=0, background="#ffffff")
        self.vsb = Scrollbar(root, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.vsb.set)
        self.vsb.pack(side="right", fill="y")
        self.canvas.pack(side="left", fill="both", expand=True)
        self.canvas.create_window((4,4), window=self.frame)
        self.canvas.create_window((4,4), window=self)
        self.bind("<Configure>", self.OnFrameConfigure)

I'm trying to put some scrollbars for my window root so as to print some lists of lessons. I 've read some related posts in stackoverflow and found some lines of code, but probably I'm doing sth wrong and cannot adjust them to my code. Any ideas, any help? I'm new to Python so please help!

1 Answer 1

1

A listbox will possibly work better than a canvas. Effbot's scrollbar and listbox example http://effbot.org/tkinterbook/scrollbar.htm

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.