Tkinter

How To Display a Tkinter Window in Fullscreen

In this tutorial, we are going to see how do I display a Tkinter window in fullscreen in Python. The .attributes() method defines the attributes specific to a platform. The attributes for the Windows platform are:

  • -alpha
  • -transparentcolor
  • -disabled
  • -fullscreen
  • -toolwindow
  • -topmost

-fullscreen specifies if the window is in full screen mode or not.
 

 

How To Display a Tkinter Window in Fullscreen

The following example shows the window in full-screen mode, to exit full-screen mode click the escape key.

from tkinter import *   

root = Tk()
root.attributes('-fullscreen', True)
root.bind('<Escape>',lambda e: root.destroy())

root.mainloop()

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *