Tkinter Wiki   MaximizedWindow UserPreferences
 
HelpContents FindPage Diffs Info Edit Subscribe XML Print View

1. 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:

1.1. Example

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

1.2. Alternative

Chad Netzer (cnetzer at mail.arc.nasa.gov) posted the following code at http://mail.python.org/pipermail/python-list/2003-May/203675.html

1.3. 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


PythonPowered