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

PythonTkinterGUI-Programming

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.

raja
Published on 06-Mar-2021 08:49:44
Advertisements