I am trying to remove the title bar of a tkinter window. I want to make a custom title bar. I have searched for this answer and I found this.
import tkinter as tk
root = tk.Tk()
# eliminate the titlebar
root.overrideredirect(1)
# your code here ...
root.mainloop()
When I run this code, the code runs without an error, but no window shows. If I replace
root.overrideredirect(1)
with
root.overrideredirect(0)
then it will show a normal mac style window with the three buttons in the corner.
Edit: I have also tried this
import tkinter as tk
root = tk.Tk()
# eliminate the titlebar
root.wm_attributes('-type', 'splash')
# your code here ...
root.mainloop()
This is the error message that I get
Traceback (most recent call last):
File "no-bar.py", line 5, in <module>
root.wm_attributes('-type', 'splash')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 1967, in wm_attributes
return self.tk.call(args)
_tkinter.TclError: bad attribute "-type": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, or -transparent
What can I do to create a tkinter window without a title bar?
Python 3.8.1 MacOS 10.15.6