[Tkinter-discuss] methods of control PanedWindow

Michael Lange klappnase at web.de
Thu Dec 9 20:38:41 CET 2010


Thus spoketh craf <prog at vtr.net> 
unto us on Thu, 09 Dec 2010 15:52:43 -0300:

> I Do learn to work with methods of control PanedWindow.The only that I
> failed to understand how they are used are:
> 
> PanedWindow.proxy_coord()
> PanedWindow.proxy_forget()
> PanedWindow.proxy_place(x, y)
> 
> 
> Does anyone know what they are good?

Probably to move the sash:

######################################
from Tkinter import *
root = Tk()
pw = PanedWindow(root)
pw.pack(fill='both', expand=1)
l1 = Listbox(pw)
l2 = Listbox(pw)
a = pw.add(l1)
b = pw.add(l2)

def on_left(ev):
    x,y = pw.proxy_coord()
    pw.proxy_place(x-1, y)
def on_right(ev):
    x,y = pw.proxy_coord()
    pw.proxy_place(x+1, y)
def on_return(ev):
    pw.sash_place(0, *pw.proxy_coord())
    pw.proxy_forget()

pw.update_idletasks()
pw.proxy_place(*pw.sash_coord(0))
pw.proxy_forget()

root.bind('<Left>', on_left)
root.bind('<Right>', on_right)
root.bind('<Return>', on_return)
root.mainloop()
#####################################

However I don't know why one would want to do this, either. I'd prefer to
directly move the sash (as with opaqueresize=True).

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

The more complex the mind, the greater the need for the simplicity of
play.
		-- Kirk, "Shore Leave", stardate 3025.8


More information about the Tkinter-discuss mailing list