I am trying to change the text of a button with a click event, but am having trouble and have found no other solutions.
from Tkinter import *
root=Tk()
def buttonclick()
oneButton["text"]="Bye"
OneButton = Button(root, text="hi", command = lambda: buttonclick()).grid (row=0, column =0, sticky=NSEW)
root.mainloop()
With this method, I am getting:
TypeError: 'NoneType' object does not support item assignment
I have looked at oneButton.config(text="bye")
and oneButton.configure(text="Bye")
as well and with both. I learn that the button object does not have the attribute config
or configure
.
What am I doing wrong?