Reputation: 31
Edited to try and make it clearer, but basically this code below doesn't overwrite the text of the label, but it overwrites the title of the window. How would I make it so that the self.label
gets updated in the same way the master.title
gets updated?
class GUI:
def __init__(self, master):
self.master = master
master.title("Title")
self.label = Label(master, text="Label")
class login(GUI):
def __init__(self, master):
super().__init__(master)
master.title("New Title")
self.label = Label(master, text="New Label")
Upvotes: 0
Views: 353
Reputation: 26
you can use self.label.config(text="New label")
to update your label content, to change your master title, you only have to use self.master.title("New Title")
class GUI:
def __init__(self, master):
self.master = master
self.master.title("Title")
self.label = Label(master, text="Label")
class login(GUI):
def __init__(self, master):
super().__init__(master)
master.title("New Title")
self.label.config(text="New Label")
Upvotes: 1