I have the following code:
from tkinter import *
class MyApplication(Tk):
def __init__(self):
super().__init__()
self.title = "Root Window"
self.bind("<1>", self.showChild)
def showChild(self):
child = Toplevel(self)
child.title = "This is the CHILD window"
app = MyApplication()
app.mainloop()
The child window’s title is invariably set to "Root Window". I can’t figure out how to set the child window’s title. I’ve also tried child.wm_title = "This is the CHILD window" to no avail. The docs at http://effbot.org/tkinterbook/ and http://www.tkdocs.com/ seem a bit outdated and haven’t helped at all.
How do I set a Toplevel widget’s title to something other than it’s master’s title??
Note: I’m pretty sure this is irrelevant, but I’m using Python 3.2
Set the title with the
.title()method,instead of treating it as an attribute.