How to start your application in a maximized window

If you want to start your application in a maximized window you can use this recipe:

Example

root = Tk()
toplevel = root.winfo_toplevel()
toplevel.wm_state('zoomed')

Alternative

Chad Netzer (cnetzer at mail.arc.nasa.gov) posted the following code at http://aspn.activestate.com/ASPN/Mail/Message/squeak/1629470

Example

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

tkinter: MaximizedWindow (last edited 2010-07-26 11:59:12 by localhost)