python change label text

Solutions on MaxInterview for python change label text by the best coders in the world

showing results for - "python change label text"
Kiara
25 Mar 2018
1 pythonCopyimport tkinter as tk
2
3class Test():
4    def __init__(self):
5        self.root = tk.Tk()
6        self.label = tk.Label(self.root, text="Text")
7
8        self.button = tk.Button(self.root,
9                                text="Click to change text below",
10                                command=self.changeText)
11        self.button.pack()
12        self.label.pack()
13        self.root.mainloop()
14
15    def changeText(self):
16        self.label.configure(text="Text Updated")        
17
18app=Test()
19
similar questions
label for attribute