Hi Michael,

<snipped>
The only thing I can think of is to catch the <Configure> event and try
to determine the current state of the window, like:

def on_configure(event):
    if event.widget.wm_state() == 'zoomed':
        ...update the window geometry as desired...

root.bind('<Configure>`, on_configure)
</snipped>

Thanks for your help. Here's what I discovered (Python 2.7 under Windows
7):

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.

Any other ideas?

Thanks,
Malcolm




_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to