Hello is my first question on this page, I hope not to make mistakes in the formulation of the same, well what happens is that I want to make an app that when click on a button, increase the value of a variable and appear in the text box of the window.
The problem is that I do not know how to take an integer variable, say n, that when you press the button add +1 to the value of the variable n and that it is stored in the variable n.
I hope the question was clear. I leave my code:
from tkinter import *
n=0
def sumar():
global n
n+=1
e=str(n)
produccion.set(e)
raiz=Tk()
produccion=StringVar()
prod=Entry(raiz,textvariable=produccion)
prod.pack(side=TOP)
contador=ttk.Button(raiz,text="sumador",command=sumar())
contador.pack(side=BOTTOM)
raiz.mainloop()