How to display full-screen mode on Tkinter?

Tkinter displays the application window by its default size. However, we can display a full-screen window by using attributes('fullscreen', True) method. The method is generally used for assigning a tkinter window with properties like transparentcolor, alpha, disabled, fullscreen, toolwindow, and topmost.


#Import the tkinter library
from tkinter import *

#Create an instance of tkinter frame
win = Tk()

#Set the geometry

#Add a text label and add the font property to it
label= Label(win, text= "Hello World!", font=('Times New Roman bold',20))
label.pack(padx=10, pady=10)

#Create a fullscreen window
win.attributes('-fullscreen', True)



Running the above code will display a full-screen window that can be closed by pressing the Alt+ F4 key.

Updated on: 26-Mar-2021

11K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started