Dec-08-2018, 09:28 PM
Hello!
I'm having some trouble with my code. I can't find how to assign a command to a button. It keeps coming up with an error saying " line 5, in greeting label.config(text = ":)") AttributeError: 'NoneType' object has no attribute 'config'
I'm having some trouble with my code. I can't find how to assign a command to a button. It keeps coming up with an error saying " line 5, in greeting label.config(text = ":)") AttributeError: 'NoneType' object has no attribute 'config'
import tkinter import _tkinter def greeting(): label.config(text = "hi") def bye(): label.config(text = "bye") from tkinter import * root = Tk() label=Label(root, text = "hello").pack() button=Button(root, text = "hi", command = greeting).pack() button2=Button(root, text = "bye",command = bye).pack() root.mainloop()Thanks for any help you can give!