Maximize a Tkinter window in mswindows
Chad Netzer
cnetzer at mail.arc.nasa.gov
Thu May 8 18:46:12 EDT 2003
On Thu, 2003-05-08 at 14:39, Federico wrote:
> How can I maximize a Tkinter Window in ms windows like pushing the 2nd
> button on the top-right of the window?
A close approximation can be this:
def maximize_toplevel( widget ):
toplevel = root.winfo_toplevel()
try:
# On MS Windows one can set the "zoomed" state.
toplevel.wm_state( 'zoomed' )
except:
w = root.winfo_screenwidth()
h = root.winfo_screenheight() - 60
geom_string = "%dx%d+0+0" % (w,h)
toplevel.wm_geometry( geom_string )
return
I haven't tested the "zoomed" options; remove it if it isn't working for
you and adjust the "60" to whatever value works for you. I don't know
of a good way to automatically find the correct value for any system. I
also don't know if an event that simulates the "maximize" button of the
window manager can be sent (sadly).
finally, see:
http://effbot.org/zone/tkinter-toplevel-fullscreen.htm
--
Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)
More information about the Python-list
mailing list