Removing Title bar in Tkinter program

0 votes
I am working on a project using Tkinter library for making a GUI. This GUI will be displayed on a touch screen using raspberry pi 3.

I want to prevent user from exiting or minimising the program. Is there any way to disable or remove the title bar? Or is there a better way to achieve this?
Dec 26, 2018 in Python by ana1504.k
• 7,910 points
22,687 views

2 answers to this question.

0 votes
Since you mentioned a raspberry pi I suppose you are using Linux. In this case you can use root.attributes('-type', 'dock') (assuming your Tk instance is called root). This way, your window will have no decoration (so no close or minimize buttons) and will be always on top. If you don't want it always on top, you can use type 'splash' instead. In any case, you will need to use focus_force to be able to get keyboard focus.

import tkinter as tk

root = tk.Tk()
root.attributes('-type', 'dock')
root.geometry('200x200')
tk.Entry(root).pack()
root.focus_force()
root.mainloop()
answered Dec 26, 2018 by SDeb
• 13,300 points
+1 vote

you can remove the title bar by using this line of code

root.overrideredirect(True) # removes title bar

answered Mar 19, 2019 by anonymous
This is difficult to iconify/deiconify, and it cannot receive keyboard input.