I am having a terrible time wrapping this under my head.

What is missing here to have the scrollbar working.

Everything is displayed fine.  But the slider of the scrollbar is full length. i.e. same height as outerframe.  which is same size as the canvas.

    def setup(self):
        c = 0
        r = 0
        outer_frame = Frame(self, bg='red', padx=2, pady=2)
        outer_frame.pack()
        scrollbar = Scrollbar(outer_frame)
        scrollbar.pack( side = RIGHT, fill=Y )

        canvas = Canvas(outer_frame, height=100, scrollregion=(0,0,300,300), yscrollcommand=scrollbar.set)
        canvas.pack(side=LEFT, expand=YES, fill=BOTH)
        scrollbar.config(command=canvas.yview)

        for f in os.listdir(self.thumbnail_folder):
            fpath = os.path.join(self.thumbnail_folder, f)
            photo = PhotoImage(file=fpath)
            photo_frame = Frame(canvas, bg='white', padx=2, pady=2)
            lbl_photo = Label(photo_frame, image=photo, text=f)
lbl_photo.bind("<ButtonRelease-1>",self.photo_click)
            lbl_photo.image=photo
            lbl_photo.pack()
            lbl_name = Label(photo_frame, text=f.split('.')[0])
lbl_name.bind("<ButtonRelease-1>",self.photo_click)
            lbl_name.pack()
            photo_frame.grid(row=r, column=c)
            if c > 2:
                c = 0
                r = r + 1
            else:
                c = c + 1

Regards

Mario St-Gelais

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to