I want to make a borderless widget with tkinter that lets the user decide if they want the application to show on top of other programs or not.
I'm aware that in order to remove the borders and the toolbar I can use the method root.overrideredirect(True)
, but this also makes the window topmost automatically, as it makes the window manager ignore the widget.
Because of this, the root.attributes("-topmost",False)
and root.wm_attributes("-topmost", False)
command don't work.
Is there a way to achieve what I need? For example, another method to hide the window manager decorations or some other way to hide/restore the widget when it loses the focus? By the way, I'm using Linux Mint 20.2 Cinnamon v5.0.5 with Python 3.8.10.
from tkinter import *
root = Tk()
root.overrideredirect(True)
root.resizable(False, False)
root.geometry("420x100")
root.attributes("-topmost", False)
#root.wm_attributes("-topmost", False)
exitbtn = Button(root, text='Exit',command=root.destroy)
exitbtn.pack(side=BOTTOM)
root.mainloop()
EDIT:
After some search, I've found that root.wm_attributes('-type','splash')
works exactly as I want. But it seems that this will only work on Linux. How could I achieve that on Windows?