[Tkinter-discuss] PanedWindow proportional resizing of panes

Vasilis Vlachoudis Vasilis.Vlachoudis at cern.ch
Thu May 10 11:45:01 CEST 2012

Thank you both,

I did it with the following way
binding  the Button-1, B1-Motion, ButtonRelease-1 of the panedwindow (as in the panedwindow.tcl)
and then performing the resizing of the panes myself.

def sashmark(event):
	global paned, index, dx, dy, sashx
	index,which = paned.identify(event.x, event.y)
	if which == "sash":
		sashx = [paned.sash_coord(i)[0] for i in range(len(paned.panes())-1)]
		sx, sy = paned.sash_coord(index)
		dx = sx - event.x
		dy = sy - event.y
		index = -1

def sashdrag(event):
	global paned, index, dx, dy, sashx
	if index>=0:
		ddx = event.x - dx - sashx[index]
		paned.sash_place(index, event.x-dx, event.y-dy)
		for i in range(index+1, len(paned.panes())-1):
			paned.sash_place(i, sashx[i]+ddx, 1)
	return "break"

def sashrelease(event):
        global sashx
	del sashx


From: tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de]
Sent: 10 May 2012 11:36
To: tkinter-discuss at python.org
Subject: Re: [Tkinter-discuss] PanedWindow proportional resizing of panes

Hi Vasislis,

Thus spoketh Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch>
unto us on Thu, 10 May 2012 08:57:40 +0000:

> Thank you Emiliano,
> stretch did the job for the resizing of the window.
> For resizing the columns I now recuperate the position with the
> sash_coord and sash_place.
> However the only think I am missing is the to have an event handler
> when the sash is moved. Is there any event that is sent when the sash
> is changed?

I have not done much testing on this, but I think that at least if you
have one widget (Frame or Listbox or so) that covers one entire pane,
there should be a <Configure> event triggered for this widget each time
its pane is being resized.

Best regards


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

        "I think they're going to take all this money that we spend now
on war and death --"
        "And make them spend it on life."
                -- Edith Keeler and Kirk, "The City on the Edge of
Forever", stardate unknown.
Tkinter-discuss mailing list
Tkinter-discuss at python.org

More information about the Tkinter-discuss mailing list