I am trying to have a transparent background using Tkinter:
from tkinter import *
root = Tk()
root.attributes('-alpha', 0.1)
# root.wm_attributes('-alpha', 0.1)
# root.wm_attributes("-transparentcolor", "white")
# root.attributes("-fullscreen",True)
root.mainloop()
This code works fine in Windows, but not using Linux Mint Maya. Commented out are other options I have tried. Any suggestions what might be wrong?
When you set the attribute, the window is not yet in a start where that works. To wait for that, add root.wait_visibility(root):
from tkinter import *
root = Tk()
root.wait_visibility(root)
root.attributes('-alpha', 0.6)
root.mainloop()
(Confusingly, it can also work as a side effect of something else, like setting the window state, even to the same state it has.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With