how to disable maximize button?

Alex Martelli aleax at aleax.it
Sun Jul 7 10:06:59 EDT 2002


Cameron Laird wrote:
        ...
> though Tkinter proper doesn't provide a means to achieve this,
> there are win32 calls accessible through *that* module that
> make it happen.
> 
> I've forgotten what they are.  If I were going to pursue this,
> I'd check with operating-system experts for the correct lower-
> level calls.

If you're willing to limit your application to running only
under Win32, there are surely many ways.  For example, message
WM_NCHITTEST can be intercepted in the main windows' window-
procedure, and rather than just passing it straight through
to DefWindowProc as one usually does, one intercepts the return
value from DefWindowProc and (e.g.) changes a return value of
HTMAXBUTTON to HTNOWHERE, etc, etc.  Obtaining a disabled
_look_ for the maximize button, etc, is slightly trickier, but
can be done by similar play with WM_NCPAINT.

I guess one COULD tweak Tkinter's main window the Windows
way, with win32all or calldll or the like, to achieve these
kind of effects in Python (under Microsoft Windows only).  I
don't believe the original poster saying anything about being
willing to limit his application to Microsoft Windows only,
though, so I'm not sure any of this sub-thread is relevant.


Alex




More information about the Python-list mailing list