python 3.x - How to get these tkinter scrollbars working? -
hi cant these scrollbars working though code comes advanced user on site have tried everything. no errors dont show up
import tkinter tk #make window root = tk.tk() root.geometry("612x417") root.title("exchange rates") root.resizable(0,0) root.configure(background='lightgrey') #end #create listboxes currency selection listbox1 = tk.listbox(root, font="helvetica 11 bold", height=3, width=10) listbox2 = tk.listbox(root, font="helvetica 11 bold", height=3, width=10) #try create scroll bar scrollbar1 = tk.scrollbar(root, orient="vertical", command=listbox1.yview) listbox1.configure(yscrollcommand=scrollbar1.set) scrollbar2 = tk.scrollbar(root, orient="vertical", command=listbox2.yview) listbox2.configure(yscrollcommand=scrollbar2.set) listbox1.place(x=300,y=50) listbox2.place(x=300,y=125) scrollbar3 = scrollbar(root) scrollbar3.pack(side="right", fill="y") listbox = listbox(root, yscrollcommand=scrollbar3.set) listbox.pack() scrollbar3.config(command=listbox.yview) root.mainloop()
i don't know how managed run without error because imported tkinter tk listbox put listbox (not tk.listbox) or scrollbar3 put scrollbar (not tk.scrollbar). don't show because haven't packed/placed them!
and... have use either place, pack or grid can't use them together. used .place()
listbox1 , 2 used .pack()
scrollbar3 , listbox. whatever use first (here it's place) work others won't show up.
Comments
Post a Comment