Remove title bar in Python 3 Tkinter Toplevel

Viewed 4994

I'm trying to create a static Toplevel window with some text and no title bar with Tkinter in Python 3.6.1 on OS X 10.12.5. I believe that wm_overrideredirect(True) is the method I need to achieve this, but whenever I enter this line, the Toplevel window is not displayed. When I remove this line, the Toplevel is displayed (with a title bar).

What am I doing wrong!? This is the code I have.

import tkinter as tk

root = tk.Tk()

tw = tk.Toplevel()
tw.wm_overrideredirect(True)              # Toplevel will not display due to this line
tk.Label(tw, text='Some text').pack()

root.mainloop()
0 Answers
Related