What am I doing wrong? I want the 'refreshB' button to call the 'update' def but I get a nameError instead
class monitor():
def update(self):
print "Called"
mon = Tk()
mainFrame = Frame(mon)
mainFrame.grid(row=1, column=1)
optionFrame = Frame(mainFrame)
optionFrame.grid(row=1, column=1)
refreshB = ttk.Button(optionFrame, text='Refresh', command=lambda: update('self') )
refreshB.grid(row=1, column=1)
mon.mainloop()
monitor()
**NameError: global name 'update' is not defined**
I an not very familiar with Classes, is there something else I am supposed to add?
If the script above was not a class then I would use:
refreshB = ttk.Button(optionFrame, text='Refresh', command=lambda: update )
Which would works fine...
__init__method defined in the class and returns a new instance of the class.