Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

TypeError: 'Label' object is not callable

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading