How to Create Full Screen Window in Tkinter?

13 Apr, 2022
Prerequisite: Tkinter
There are two ways to create a full screen window in tkinter using standard python library for creating GUI applications.
Syntax:
window_name.attributes('-fullscreen',True)
We will set the parameter ‘-fullscreen’ of attributes() to True for setting size of our window to fullscreen and to False otherwise. 
Approach:
Importing tkinter package
Creating a tkinter window with name window
Setting the window attribute fullscreen as True
Giving title to the window, here ‘Geeks For Geeks’
Creating a label with text ‘Hello Tkinter’ (just for display to the user here)
Placing the label widget using pack()
Closing the endless loop of windows by calling mainloop()
Disadvantage:
We get an output tkinter WINDOW with no toolbar. This disadvantage is covered by the next method.
Program
Python3
# importing tkinter for guiimport tkinter as tk # creating windowwindow = tk.Tk() # setting attributewindow.attributes('-fullscreen', True)window.title("Geeks For Geeks") # creating text label to display on window screenlabel = tk.Label(window, text="Hello Tkinter!")label.pack() window.mainloop()
Output:
We get an output tkinter window with the toolbar above along with the title of window. 
Syntax:  
     width= window_name.winfo_screenwidth()               
     height= window_name.winfo_screenheight()               
     window_name.geometry("%dx%d" % (width, height))
We can set the parameter of geometry() same as the width*height of the screen of our original window to get our full screen tkinter window without making the toolbar invisible. We can get the width and height of our desktop screen by using winfo_screenwidth() and winfo_screenheight() functions respectively. 
Approach:
Importing tkinter package
Creating a tkinter window with name window
Getting width and height of the desktop screen using winfo_screenwidth() in variable width and winfo_screenheight() in variable height respectively.
Setting size of tkinter window using geometry () by setting dimensions equivalent to widthxheight.
Giving title to the window, here ‘Geeks For Geeks’
Creating a label with text ‘Hello Tkinter’ (just for display to the user here)
Placing the label widget using pack()
Closing the endless loop of windows by calling mainloop()
Program:
Python3
# importing tkinter guiimport tkinter as tk #creating windowwindow=tk.Tk() #getting screen width and height of displaywidth= window.winfo_screenwidth()height= window.winfo_screenheight()#setting tkinter window sizewindow.geometry("%dx%d" % (width, height))window.title("Geeeks For Geeks")label = tk.Label(window, text="Hello Tkinter!")label.pack() window.mainloop()
Output:
Syntax:
window_name.state('zoomed') 
We will set the parameter of state() to ‘zoomed’ for setting the size of our window to fullscreen by maximizing the window.
Approach:
Importing tkinter package
Creating a tkinter window with name window
Setting the window attribute state as ‘zoomed’
Giving a title to the window, here ‘Geeks For Geeks’
Creating a label with text ‘Hello Tkinter’ (just for display to the user here)
Placing the label widget using pack()
Closing the endless loop of windows by calling mainloop()
Result:
We get an output tkinter WINDOW which is already maximized. 
Program
Python3
# importing tkinter for guiimport tkinter as tk # creating windowwindow = tk.Tk() # setting attributewindow.state('zoomed')window.title("Geeks For Geeks") # creating text label to display on window screenlabel = tk.Label(window, text="Hello Tkinter!")label.pack() window.mainloop()
Output:
Output using window_name.state(‘zoomed’) 
menonkartikeya
Python-tkinter
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.