Making a Toplevel Cover the Full Screen

July 27, 2002 | Fredrik Lundh

Q. I am building a slide show application with Tkinter, and need to create a full-screen window, i.e. suppressing title bar and start menu etc.

Creating a large window is easy; just determine the size of the screen, and use the geometry method to make the window as large as the screen. To get rid of the title bar and the menus, use the overrideredirect method.

root = Tk()

# make it cover the entire screen
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (w, h))

Note that the new window may not have focus. If you want to handle key events, add an explicit call to focus_set:

root.focus_set() # <-- move focus to this widget
root.bind("<Escape>", lambda e: e.widget.quit())

FIXME: add note on X window manager overriding

FIXME: add note about wm_state(ZOOMED) in newer versions

 

A Django site. rendered by a django application. hosted by webfaction.