Home > Mobile >  Why title does not change in tkinter?
Why title does not change in tkinter?

Time:10-06

from tkinter import *
import win32api
from tkinter import filedialog
from mood import Dominant
from form import Assessment
import json
ca=Assessment()
window=Toplevel()
window.withdraw()
window.title("Analysis")

When I try to change title on the window still the title appears as "tk". I saw some answers but they were related OOP in the main window I could not change the title.

CodePudding user response:

You changed the title of the hidden Toplevel() (since you have executed window.withdraw()), not the visible root window (created implicitly).

Use window.master.title("Analysis") to change the title of the visible root window.

Or create the root window explicitly and change its title as below:

import tkinter as tk
root = tk.Tk()
window=tk.Toplevel()
window.withdraw()
root.title("Analysis")
root.mainloop()
  • Related