Creating a Transparent window in Python Tkinter

PythonTkinterGUI-Programming

Python is the most popular language for developing and creating functional and desktop applications. It has a rich library of different modules and functions which provides extensibility and accessibility to create and develop applications.

Tkinter is the most commonly used 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 transparent window using tkinter. To create the transparent window, we can use the attributes property and define the opacity value.

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")

#To Make it transparent use alpha property to define the opacity of
the frame
win.attributes('-alpha', 0.3)
win.mainloop()

Output

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

raja
Published on 04-Mar-2021 13:38:42
Advertisements