How to change the title bar in Tkinter?

TkinterServer Side ProgrammingProgramming

Tkinter initially sets a default title bar for every application. We can update or replace the Title Bar of the Tkinter application by configuring the title("Enter any Title") method. For a particular application, let us see how we can change the title of a Tkinter application that calculates the square of a number.


#Import the required Libraries
from tkinter import *
from tkinter import ttk
import math

#Create an instance of Tkinter frame
win = Tk()

#Set the geometry of tkinter frame

#Set the Title of Tkinter window
win.title("Square Calculator")

def find_square():
   no= int(entry.get())
   Label(win, text=no*no).pack()

#Create an entry widget to accept user input
entry= Entry(win, width=40)
entry.pack(ipadx= 20,pady=20)

#Create a button to calculate the number
ttk.Button(win, text= "Calculate", command= find_square).pack()


The above program calculates the square of the given number in the Entry widget. Thus, the program window Title has been renamed to "Square Calculator".

Updated on 04-May-2021 14:27:13