Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Turtle
  • Python PIL
  • Python Program
  • Python Projects
  • Python DataBase
  • Python Flask
  • Python Django
  • Numpy
  • Pandas
  • Python Database
  • Data Science With Python
  • Machine Learning with Python
  • Django
  • Flask
  • R
Open In App
Next Article:
PySide2 – How to create window?
Next article icon

How to Create Full Screen Window in Tkinter?

Last Updated : 13 Apr, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Prerequisite: Tkinter

There are two ways to create a full screen window in tkinter using standard python library for creating GUI applications.

Method 1: Using attributes() function

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 gui
import tkinter as tk
 
# creating window
window = tk.Tk()
 
# setting attribute
window.attributes('-fullscreen', True)
window.title("Geeks For Geeks")
 
# creating text label to display on window screen
label = tk.Label(window, text="Hello Tkinter!")
label.pack()
 
window.mainloop()
                      
                       

Output:

Method 2: Using geometry() function

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 gui
import tkinter as tk
 
#creating window
window=tk.Tk()
 
#getting screen width and height of display
width= window.winfo_screenwidth()
height= window.winfo_screenheight()
#setting tkinter window size
window.geometry("%dx%d" % (width, height))
window.title("Geeeks For Geeks")
label = tk.Label(window, text="Hello Tkinter!")
label.pack()
 
window.mainloop()
                      
                       

Output:

Method 3: Using state() function

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 gui
import tkinter as tk
 
# creating window
window = tk.Tk()
 
# setting attribute
window.state('zoomed')
window.title("Geeks For Geeks")
 
# creating text label to display on window screen
label = tk.Label(window, text="Hello Tkinter!")
label.pack()
 
window.mainloop()
                      
                       


Output:

Output using window_name.state(‘zoomed’) 



Next Article
PySide2 – How to create window?
author
shubhigupta22
Improve
Article Tags :
  • Python
  • Python-tkinter
Practice Tags :
  • python

Similar Reads

  • How To Center A Window On The Screen In Tkinter?
    Tkinter provides a basic geometry manager to control the placement of widgets within a window, it doesn't offer a built-in method to automatically center a window on the screen. However, achieving this task is relatively straightforward with a few lines of code. In this article, we'll explore differ
    2 min read
  • How to close a window in Tkinter?
    Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter is the fastest and easiest way to create GUI applicatio
    1 min read
  • PySide2 – How to create window?
    PySide2 is one of the most famous libraries in python for building GUI applications. In this article, we will build an empty window using PySide2 Library. Steps to create empty window : 1. Import PySide2 in your code 2. Create QApplication object 3. Create object for QWidget 4. Increase the size of
    1 min read
  • How to create Option Menu in Tkinter ?
    The Tkinter package is the standard GUI (Graphical user interface) for python, which provides a powerful interface  for the Tk GUI Toolkit. In this tutorial, we are expecting that the readers are aware of the concepts of python and tkinter module. OptionMenu In this tutorial, our main focus is to cr
    4 min read
  • How To Get Rid Of Python Tkinter Root Window?
    Python's Tkinter library offers a simple and effective way to create graphical user interfaces (GUIs) for your applications. However, when using Tkinter, you may encounter situations where you need to close or remove the root window, which is the main window of your GUI. Whether you're looking to cl
    2 min read
  • How to create a multiline entry with Tkinter?
    Tkinter is a library in Python for developing GUI. It provides various widgets for developing GUI(Graphical User Interface). The Entry widget in tkinter helps to take user input, but it collects the input limited to a single line of text. Therefore, to create a Multiline entry text in tkinter there
    3 min read
  • How to add a margin to a tkinter window?
    In this article, we will see how to add a margin to the Tkinter window.  We will use the frame for adding the margin: Syntax: Frame(root, options) Approach: Importing the module.Create the main window (container)Use frame and frame.pack()Apply the event Trigger on the widgets. Without using frame me
    2 min read
  • How to create a frame inside a frame tkinter?
    Prerequisite: Tkinter It is very easy to create a basic frame using Tkinter, this article focuses on how another frame can be created within it. To create a basic frame the name of the parent window is given as the first parameter to the frame() function. Therefore, to add another frame within this
    2 min read
  • How To Bind The Enter Key To A Tkinter Window?
    Tkinter is a Python library to develop GUI applications. Tkinter has many useful widgets that are necessary to build desktop applications. In this article, we will learn how to bind an Entry widget with a Tkinter Window. Binding Key in TkinterA key event occurs when the user clicks on any key on the
    3 min read
  • How to change border color in Tkinter widget?
    Prerequisites: Tkinter GUI, Tkinter Widgets Tkinter is Python’s standard GUI package which provides us with a variety of common GUI elements such as buttons, menus, and various kinds of entry fields and display areas which we can use to build out an interface. These elements are called Tkinter Widge
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences