Creating Tkinter full-screen application

PythonTkinterServer Side ProgrammingProgramming

Tkinter initially creates a window that contains application components such as widgets and control bars. We can switch a native-looking application to a full-screen application by using the attribute(‘-fullscreen’, True) method. To make the window full-screen, just invoke the method with the particular window.

Example

#Import tkinter library
from tkinter import *
#Create an instance of tkinter frame or window
win= Tk()
#Set the geometry of tkinter frame
win.geometry("750x250")
#Create a Text widget
text= Label(win, text=" Hello\nWelcome to Tutorialspoint.com!",font=('Century Schoolbook', 20, 'italic bold'))
text.pack(pady=30)
win.attributes('-fullscreen',True)
win.mainloop()

Output

Executing the above code will display a full screen window.

Since the Windows control bars are hidden, we can close the window by pressing "Alt +F4".

raja
Published on 21-Apr-2021 07:33:54
Advertisements