Sep-18-2019, 09:16 AM
Hello.
I'm trying to write a program that show a tkinter window with a list of names(labels) and a checkbox for every name in this list.
I want to be able to scroll through this list
but for some reason the scrollbar doesn't work on the canvas widget(gray, not clickable scrollbar),even if the there are more labels at the bottom of the window(the window cut all the remained names and doesn't let me scroll down.).
this is my code:
what I'm doing wrong here?
thanks
I'm trying to write a program that show a tkinter window with a list of names(labels) and a checkbox for every name in this list.
I want to be able to scroll through this list
but for some reason the scrollbar doesn't work on the canvas widget(gray, not clickable scrollbar),even if the there are more labels at the bottom of the window(the window cut all the remained names and doesn't let me scroll down.).
this is my code:
from tkinter import * master = Tk() master.title("Names") master.geometry('300x200+750+480') programs = ['yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy', 'yyy'] programs_path = [] frame = Frame(master) frame.pack(side=LEFT) canvas = Canvas(frame) canvas.pack(side=LEFT, fill=Y) scroll = Scrollbar(frame, orient=VERTICAL) scroll.pack(side=RIGHT, fill=Y) for i in range(len(programs)): program_label = Label(canvas, text=str(programs[i])) program_label.grid(row=i, column=0) check_box = Checkbutton(canvas) check_box.grid(row=i, column=1) scroll.config(command=canvas.yview) canvas.config(yscrollcommand=scroll.set) master.mainloop()I'm using Python3 with the tkinter module.
what I'm doing wrong here?

thanks