Computer >> Computer tutorials >  >> Programming >> Python

How to use Tkinter in python to edit the title bar?


Tkinter creates a window or frame that appears after executing the program. Since all the functions and modules in Tkinter are independent, we can specifically use a particular function to customize the window attributes.

Tkinter creates a default root window for every application. To customize or edit the default title of Tkinter window, we can use the following method,

title(text= “your title”)

Let us create a window by initiating an object of Tkinter frame and edit the title of the window or frame.

Example

#Import the library
from tkinter import *

#Create an instance of window
win= Tk()

#Set the geometry of the window
win.geometry("700x400")

#Set the title of the window
win.title("tutorialspoint.com")

#Create a label if needed
Label(win, text= "The Title is tutorialspoint.com", font=('Helvetica bold',20), fg= "green").pack(pady=20)

#Keep running the window or frame
win.mainloop()

Output

The above Python code will set the title as tutorialspoint.com.

How to use Tkinter in python to edit the title bar?