help with a program in tkinter | SoloLearn: Learn to code for FREE!


help with a program in tkinter

I am making a counter program in which every time I touch the "+" button it has to increase the number that is displayed after the "counter:" label, but I can only make it increase from 0 to 1 and it does not increase anything else. I am new to graphical interfaces. My code: from tkinter import * def sumar(): resultado.set(numero+1) root=Tk() root.title("Contador") numero=0 resultado=IntVar() Label(root,text="Contador:").grid(row=0,column=0) Entry(root,justify=CENTER,state="disable",textvariable=resultado).grid(row=0,column=1) Button(root,text="+",command=sumar).grid(row=0,column=2) root.mainloop()

5/7/2021 6:35:58 PM


4 Answers

New Answer


Because you are not incrementing Numero variable Numero + 1 will always be 1 Because Numero variable has 0 in it


Ohhhh i see


Thank you very much


Need help with sql query (cakes)