python - TK, understanding pack and expanding space -
i have window resizeable, want have 2 listboxes scroll bars expand fill space available.
when have 1 listbox packed fill=both, expand=1, side=left
, 1 scrollbar packed fill=y, expand=0, side=right
expand horizontally, though set fill both directions. when resize window, listbox fill sides. bottom of window remain empty.
then moved on add listbox. instead of packing scroll bar on right, packed left, stacked. listboxes continue have fill=both, expand=1
. when resize window both list boxes fill vertically! horizontal space remains empty.
what going on? why ignore vertical space 1 element packed left , right? , why refuses fill horizontally when stacked left?
the fact once fill vertical or horizontal space leads me believe parent frame expanding fine... or should investigate more well?
without seeing actual code it's impossible know you're doing wrong. here's example prove pack
works documented:
import tkinter tk root = tk.tk() lb1 = tk.listbox(root) lb2 = tk.listbox(root) vsb1 = tk.scrollbar(root, orient="vertical", command=lb1.yview) vsb2 = tk.scrollbar(root, orient="vertical", command=lb2.yview) lb1.configure(yscrollcommand=vsb1.set) lb2.configure(yscrollcommand=vsb2.set) lb1.pack(side="left", fill="both", expand=true) vsb1.pack(side="left", fill="y", expand=false) lb2.pack(side="left", fill="both", expand=true) vsb2.pack(side="left", fill="y", expand=false) root.mainloop()
Comments
Post a Comment