Home > Net >  TypeError: 'Label' object is not callable
TypeError: 'Label' object is not callable

Time:11-20

import os
os.system ("clear") 

root = Tk()
root.title('Test')
root.geometry('1000x600')

def submit():
    submit_text = Label(root, text="Todays income is"   Textbox.get())
    submit_text.pack()




Label = Label(root, text='Enter the first mounth')
Label.pack()

Textbox = Entry(root, width=30)
Textbox.pack()

Button = Button(root, text="submit", command=submit)
Button.pack()

root.mainloop() 

i wrote this and got this error.i dont know where i messed up cuz i watched a youtube tutorial and trying to make a desktop project

  File "d:\projects\P1.PY", line 10, in submit
    submit_text = Label(root, text="Todays income is"   Textbox.get())
TypeError: 'Label' object is not callable

i am very new and started coding today any help?

CodePudding user response:

I assume that the issue is here.

Label = Label(root, text='Enter the first mounth')
Label.pack()

Label is now a Label object(not a Label class anymore). So try renaming the variable name. For example,

label = Label(root, text='Enter the first mounth')
label.pack()
  • Related