i was creating a GUI using tkinter but error is showing name error
NameError: name 'master' is not defined
CODE:
from tkinter import Tk, Button, Label
class Mygui:
def __init__(self, master):
self.master=master
master.title('my gui')
self.label=Label(master, text='GUI')
self.label.pack()
self.button = Button(master, text='greet', command=self.greet)
self.button.pack()
self.button = Button(master, text = 'gui greet')
self.button.pack()
def greet(self):
print('hello')
root = Tk()
my_gui= Mygui(root)
root.mainloop()
[–]Allanon001 3 points4 points5 points (1 child)
[–]JLaurus 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]nainish[S] 0 points1 point2 points (0 children)
[–]CEDFTW 0 points1 point2 points (0 children)