Tkinter - Maximized Window


Tkinter - Maximized Window

In Tkinter, you can initialize a maximized window by setting the state of the window to zoomed. Maximized window means the window occupies the whole screen.

Tkinter - Maximized Window

To initialize a Tkinter window with maximized state, create the window and set the state to zoomed as shown in the following.

window = tk.Tk()
window.state("zoomed")

In this tutorial, you will learn how to maximize a Tkinter window, with examples.

Examples

1. Maximize Tkinter window

In this example, we create a basic Tk window in maximized state.

Python Program

import tkinter as tk

# Create the main window
window = tk.Tk()
window.title("PythonExamples.org")
# Maximize window
window.state("zoomed")

label = tk.Label(window, text="Hello World!")
label.pack()

# Run the application
window.mainloop()

Output

In Windows

In MacOS

Tkinter - Maximized Window - Example
Tkinter - Maximized Window

Summary

In this Python Tkinter tutorial, we learned how to create a Tkinter window in maximized state, with examples.