How to create a borderless fullscreen application using Python-3 Tkinter?

PythonTkinterServer Side ProgrammingProgramming

In order to make a Tkinter window borderless and full-screen, we can use the utility method attributes(‘-fullscreen’, True). Tkinter windows can be configured using functions and methods defined in the Tkinter library.

Another similar method Tkinter provides to make the application window full-screen is, overrideredirect(True). This method can be invoked only if the application needs to resize in its defined width and height only.

Example

#Import the required Libraries
from tkinter import *
#Create an instance of Tkinter frame
win= Tk()
#Set the Geometry
win.geometry("750x250")
#Full Screen Window
win.attributes('-fullscreen', True)
def quit_win():
   win.destroy()
#Create a Quit Button
button=Button(win,text="Quit", font=('Comic Sans', 13, 'bold'), command= quit_win)
button.pack(pady=20)
win.mainloop()

Output

Running the above code will display a full-screen window.

Click the "Quit" button to close the full-screen window.

raja
Published on 22-Apr-2021 07:05:04
Advertisements