Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this error TypeError: 'Button' object is not callable mean?

Tags:

python

tkinter

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()
like image 509
Rayan Jirow Avatar asked Sep 04 '25 03:09

Rayan Jirow


1 Answers

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()
like image 162
DeepSpace Avatar answered Sep 07 '25 18:09

DeepSpace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!