0

i know that there is alot of these questions around, some thats said to work, and some thats said that dont work, however most of them are more than 2 years old, so i thought that something might have change that makes mine not work, what i want to do is simply make a tkinter window transparent, using python 3.4,

here is my code:

from tkinter import *
import time
root = Tk()
root.geometry('600x300')
root.wm_attributes('-alpha',0.3)
l = Label(root,bg='white',text='Text',width=50,height=20)
l.pack()


root.mainloop()

this creates a window, a label, etc, but i dont see any transparency, id realy like any help... thanks

oh, btw im using linux, ive got the wm_atributes from another website, its said to work, but it might have been meant that it works for windows

Cid-El
  • 500
  • 7
  • 30

1 Answers1

0

Oh, lookslike the problem is with Linux, ive copied the propgram to windows 7 and now it works, thanks for the help, so for anyone else who might find this usefull:

using:

from tkinter import *
import time
root = Tk()
root.geometry('600x300')
root.wm_attributes('-alpha',0.3)
l = Label(root,bg='white',text='Text',width=50,height=20)
l.pack()


root.mainloop()

this works in windows, but not for linux for some reason...

hope this helped

thanks!

Cid-El
  • 500
  • 7
  • 30
  • 2
    The reason some features sometimes don't work is because Tcl/tk (and by extension, tkinter) rely heavily on the operating system's underlying framework/window manager. If the window manager doesn't know how to handle alpha, tkinter can't help it. In a similar vein, tkinter programs on OS X using the aqua window manager/theme can't change the color of buttons- it's all the underlying framework. – Delioth Jun 24 '16 at 20:05
  • 1
    On Ubuntu 16.04, you can make it work using `root.wait_visibility(root)` - See http://stackoverflow.com/questions/18394597/is-there-a-way-to-create-transparent-windows-with-tkinter – Josselin May 20 '17 at 22:45