Creating a Frameless window in Python Tkinter


Tkinter is the most commonly used Python library for creating GUI-based applications. It has features like adding widgets and other necessary attributes.

Let us suppose that we want to create a borderless window using tkinter. To create a borderless window, we can use the overrideredirect method which basically disables the window and removes the window element such as the closing button, title, minimization element and buttons, etc.

overrideredirect is a Boolean function which can be either True or False. Once the window is opened, it can be closed by pressing Alt+F4.

Example

#Importing the tkinter library
from tkinter import *

#Create an instance of tkinter frame
win= Tk()

#Define the size of the window or frame
win.geometry("700x400")

#Define the window text widget
lab= Label(win, text= "Hello World", font=('Time New Roman', 35), fg="green", anchor= "c").pack()

#Make the window borderless
win.overrideredirect(True)

win.mainloop()

Output

Running the above code will generate the output and will show a borderless window.

Updated on: 04-Mar-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements