iconify/deiconify catches in Tkinter

Jeff Epler jepler at unpythonic.net
Mon Jan 20 12:15:35 EST 2003


On Thu, Jan 09, 2003 at 10:01:58PM -0000, Cameron Laird wrote:
> No time now to tell full story.  Briefly, bind to
> <Unmap> for iconify, and for maximize ... ummmm,
> someone will have to get back to you.

Except possibly on Windows with some versions of Tk, Tk can't tell the
difference between a Maximize and any other resize.

Bind the <Configure> event on . to respond to window size changes.  On
Windows only, you can check for .wm_state() == "zoomed" to find out if
your window is maximzed.

It may be possible to find whether a window is maximized in X with an
ICCCM-compliant window manager, but probably not with unmodified Tk.
I know that you can, with some success, ask the window manager to
maximize a window (rather than trying to guess how to set the geometry).
You're likely to work on only a subset of window managers and you may
not be able to do it without writing C code.

"Your" window will see a PropertyNotify event, but binding <Property>
appears not to work.  This is probably because the so-called Toplevel is
actually wrapped by another window which contains the Toplevel and its
menubar, and the PropertyNotify event is not being propagated from the
wrapper window.  This is unfortunate.  xev clearly shows the related
events under my window manager:
    PropertyNotify event, serial 26, synthetic NO, window 0x2600001,
        atom 0x114 (_WIN_STATE), time 3700616417, state PropertyNewValue

    PropertyNotify event, serial 26, synthetic NO, window 0x2600001,
        atom 0x6b (WM_STATE), time 3700616417, state PropertyNewValue

    PropertyNotify event, serial 26, synthetic NO, window 0x2600001,
        atom 0x114 (_WIN_STATE), time 3700616424, state PropertyNewValue

    PropertyNotify event, serial 26, synthetic NO, window 0x2600001,
        atom 0x6b (WM_STATE), time 3700616424, state PropertyNewValue
but a Toplevel's binding on <Property> doesn't seem to work.

Jeff





More information about the Python-list mailing list