Tkinter allows developers to build GUI applications in Python with ease. If you want your window to cover the entire screen, for example in kiosk applications or immersive displays, Tkinter makes it simple to go full screen. Check how to enable and manage full-screen mode in a Tkinter window.
Enable Full-Screen Mode
The easiest way to make a Tkinter window full screen is by using the attributes()
method with the -fullscreen
attribute:
import tkinter as tk
root = tk.Tk()
root.attributes("-fullscreen", True)
root.mainloop()
This makes the window occupy the entire screen, hiding the title bar and borders.
Exit Full-Screen with a Key
To allow users to exit full-screen mode, you can bind a key (e.g. Escape
) to toggle the setting:
def toggle_fullscreen(event=None):
is_full = root.attributes("-fullscreen")
root.attributes("-fullscreen", not is_full)
def exit_fullscreen(event=None):
root.attributes("-fullscreen", False)
root.bind("<F11>", toggle_fullscreen)
root.bind("<Escape>", exit_fullscreen)
This setup enables toggling full-screen with F11 and exiting with Escape.
Alternative: Maximize Without Removing Borders
If you want to maximize the window without removing the title bar or borders, use the state('zoomed')
method (Windows only):
root.state('zoomed')
This will maximize the window but still show the title bar and allow resizing.
Full Example
Here’s a complete example with full-screen toggling and key bindings:
import tkinter as tk
def toggle_fullscreen(event=None):
is_full = root.attributes("-fullscreen")
root.attributes("-fullscreen", not is_full)
def exit_fullscreen(event=None):
root.attributes("-fullscreen", False)
root = tk.Tk()
root.title("Full-Screen Demo")
root.attributes("-fullscreen", True)
root.bind("<F11>", toggle_fullscreen)
root.bind("<Escape>", exit_fullscreen)
label = tk.Label(root, text="Press F11 to toggle full screen, Escape to exit", font=("Arial", 18))
label.pack(expand=True)
root.mainloop()