Jul-03-2020, 07:18 AM
I am tinkering with tkinter, trying to get the feel of it.
I make a nice window:
then I set width = 75 for my Listbox.
But width = 75 is almost equal to 640 pixels!
What units does tkinter use for width parameters??
I make a nice window:
def myApp(): root = Tk() root.title("Scrollbar Test") root.config(bg='light blue') root.geometry("640x480") xscrollbar = Scrollbar(root, orient=HORIZONTAL, width=20, activebackground='red', ) yscrollbar = Scrollbar(root, orient=VERTICAL, width=20, activebackground='green', ) xscrollbar.pack( side = BOTTOM, fill = X ) yscrollbar.pack( side = RIGHT, fill = Y ) # setting Listbox width = 75 makes it almost equal to the root window width of 640 mylist = Listbox(root, xscrollcommand = xscrollbar.set, yscrollcommand = yscrollbar.set, width = 75) #mylist = Listbox(root, yscrollcommand = yscrollbar.set ) for line in range(100): mylist.insert(END, "This is a very very long line with a line number added line number " + str(line)) mylist.pack( side = LEFT, fill = BOTH ) xscrollbar.config( command = mylist.xview ) yscrollbar.config( command = mylist.yview ) mainloop()root.geometry is set to ("640x480")
then I set width = 75 for my Listbox.
But width = 75 is almost equal to 640 pixels!
What units does tkinter use for width parameters??