[Tkinter-discuss] PanedWindow proportional resizing of panes

Vasilis Vlachoudis Vasilis.Vlachoudis at cern.ch
Wed May 9 16:52:36 CEST 2012


Hi all,

in my application I am using the recipe of
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266
to create a multilistbox. I have modified it to use the panedwindow in order to allow the resize of the rows, like in the code below.
My problem(s) (all related to the resizing of the panes)
1. is how to make the resizing of the window to resize proportionally the panes (Now only the last row "Four" expands/reduce its size)
2. when the user manually resize one pane (e.g. drag between two|three, only the panes two and three are resized while I would prefer more a behavior like all other window toolkits that only "two" will be resized, "three" will remain the same and the last one "Four" will be reduced or expanded.
3. How to save/recall the size of the panes. The paneconfig(child,"width") returns a tuple with ('width','','','')

from Tkinter import *
tk = Tk()
paned = PanedWindow(tk, orient=HORIZONTAL, showhandle=0, handlepad=0,
        handlesize=0, sashwidth=2, opaqueresize=1)
paned.pack(side=LEFT, expand=YES, fill=BOTH)
for l,w in [("One",5),("Two",10),("Three",15), ("Four",30)]:
    frame = Frame(paned, border=0)
    paned.add(frame,minsize=16)
    lbl = Label(frame, text=l, borderwidth=1, relief=RAISED)
    lbl.pack(fill=X)
    lst =  Listbox(frame, width=w, background="White")
    lst.pack(expand=YES, fill=BOTH)
    for i in range(100): lst.insert(END,"#%d"%(i))
tk.mainloop()

Vasilis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20120509/498c8a27/attachment.html>


More information about the Tkinter-discuss mailing list