I wanted to create a GUI with Tkinter in Linux (Python3.x). When I tried to execute the following: -
from tkinter import *
import tkinter
root = Tk()
root.overrideredirect(True) # Hide the cross button and that bar
root.wait_visibility(root)
root.call("wm", "attributes", ".", "-transparent", "true")
root_w = 190
root_h = 190
win_w = root.winfo_screenwidth()
win_h = root.winfo_screenheight()
root.geometry(f'{root_w}x{root_h}+{win_w - root_w - 40}+{win_h - root_h - 40}')
samplabl = Button(root, text=f"WIDTH: {win_w} HEIGHT: {win_h}", bg='#ffffff')
samplabl.pack()
root.mainloop()
This is what I get: -
Traceback (most recent call last):
File "/home/bravo6/Desktop/Stella__Compilative/GUI/temp.py", line 8, in <module>
root.call("wm", "attributes", ".", "-transparent", "true")
_tkinter.TclError: bad attribute "-transparent": must be -alpha, -topmost, -zoomed, -fullscreen, or -type
Looks like the wm_attribute
didn't recognise the -transparent
attribute... It seemed that it only works in Windows. Any idea how to get this working in Linux?
There is nothing you can do. Different operating systems support different options for the window manager. As of the time I write this, these are the supported attributes for each windowing system:
All platforms: alpha
, fullscreen
, topmost
OSX: modified
, notify
, titlepath
, transparent
Windows: disabled
, toolwindow
, transparentcolor
X11-based systems (ie: linux, and only with some window managers) : type
, zoomed
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