[Tkinter-discuss] Removing/disabling a resizable window's maximize button under Windows

Michael Lange klappnase at web.de
Thu Dec 2 12:27:26 CET 2010


Thus spoketh python at bdurham.com 
unto us on Thu, 02 Dec 2010 06:01:01 -0500:

> Binding a toplevel window's <Configure> event traps <Configure> events
> for all of the window's widgets, not just the window itself. So here's
> how I coded my event handler:
> def onFrmResize( event=None ):
> 	if not hasattr( event.widget, 'state' ):
> 		return
> 	if event.widget.state() == 'zoomed':
> 		# proves I'm trapping maximize event
> 		print 'maximize detected'
> 		# return 'break' <--- does not work
> 		# event.widget.geometry( '+100+100' ) <--- does not work
> I can confirm that my event handler is being called properly via the
> print message, but both return 'break' and explicitly setting position
> via the geometry method appear to be ignored when executed within the
> event handler.

return "break" will not work, because the Configure event is triggered
*after* the maximizing occurs, I suppose.
I can confirm that maximing a window always moves it into the upper left
corner of the screen on X11 with IceWM, too. Maybe it's oddities like this
which drive some programmers to draw their own custom titlebars instead of
using the WM's default ones.

> Any other ideas?

Actually the first thought was to change the default behavior of the
maximize button somehow through wm_protocol(). The obvious
wm_protocol("WM_MAXIMIZE_WINDOW") does not work (at least here) though,
and it's hard to find documentation on this.



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

We do not colonize.  We conquer.  We rule.  There is no other way for us.
		-- Rojan, "By Any Other Name", stardate 4657.5

More information about the Tkinter-discuss mailing list