1

I am trying to make transparent GUI using Tkinter in python, Please help me how can I make this type GUI Transparent GUI enter image description here

import tkinter as tk 
r = tk.Tk() 
r.title('Counting Seconds') 
button = tk.Button(r, text='Stop', width=25, command=r.destroy) 
button.pack() 
r.mainloop()
  • Possible duplicate of [Transparent background in a Tkinter window](https://stackoverflow.com/questions/19080499/transparent-background-in-a-tkinter-window) – Rahul Jun 01 '19 at 06:24
  • What OS are you on? And is that an image on your screen or you just want the shape of the window like that? – Saad Jun 01 '19 at 08:07

1 Answers1

0

You need to use wm_attributes:

import tkinter as tk

root = tk.Tk()
# load image
root.image = tk.PhotoImage(file='image.gif')
# disable window movement
root.overrideredirect(True)
# setup start window position
root.geometry("+800+200")
# initialise wm attributes
root.wm_attributes()
# setup transparency
root.wm_attributes("-alpha", 0.5)
# setup label
label = tk.Label(root, image=root.image, bg='white')
label.pack()
label.mainloop()
Zaraki Kenpachi
  • 5,510
  • 2
  • 15
  • 38