Syntax error How to remove the icon from the title bar in Tkinter?

How to remove the icon from the title bar in Tkinter?



To remove the default icon of the Tkinter window, we can use wm_attributes('type', 'value') method by specifying the type of property. In the following example, we will use '-toolwindow', a Boolean value that removes the icon associated with the title bar of the application.

Example

#Import the tkinter library
from tkinter import *

#Create an instance of tkinter frame
win = Tk()
win.geometry("700x350")

#Create a Label to print the Name
label= Label(win, text="This is a New Line Text", font= ('Helvetica 14 bold'), foreground= "red3")
label.pack()

win.wm_attributes('-toolwindow', 'True')
win.mainloop()

Output

When we run the above code, it will display a Tkinter window without its default icon on the title bar.

Updated on: 2021-05-25T08:52:26+05:30

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements