This is my first time coding in tkinter. When I try to create a new button in the function 'Registering' i keep getting the same error 'Button' object is not callable. I don't understand what this error is suggesting about the simple code I have written. Can anyone clarify this for me in the context of the code below?
from tkinter import *
root = Tk()
def Registering():
window = Toplevel(root)
login_button = Button(window, width = 120, height = 42)
Button = Button(root,text= "Enter",command=Registering)
Button.pack()
root.mainloop()
Button = Button(root,text= "Enter",command=Registering)
Button.pack()
By doing Button = Button (...
you override tkinter's definition of Button
.
Use a different (hopefully more meaningful) name:
register_button = Button(root,text= "Enter",command=Registering)
register_button.pack()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.