Tkinter - Set title for window
Tkinter - Set title for window
In Tkinter, you can set required string value for the title of window.
To set a specific string value for the title of window in Tkinter, call the title() method on the Tk window object, and pass the title string value as argument.
window = tk.Tk()
window.title("My Application")
In this tutorial, you will learn how to set a title for Tkinter window using Tk.title() method, with an example program.
Example
Consider a simple use case where you would like to create a Tk window, and set its title to say My Application.
Python Program
import tkinter as tk
# Create the main window
window = tk.Tk()
window.geometry("300x200")
# Set title for the window
window.title("My Application")
# Run the application
window.mainloop()
Output in Windows
Output in MacOS
Summary
In this Python Tkinter tutorial, we learned how to set a title for window in Tkinter, with examples.