0
good afternoon I was studying graphical interfaces in Kinter and this problem arose My interface has a simple button and its function was simply to print the contents of a variable that was passed in argument, but this when it is created it automatically runs and then when I press it no longer runs Follows the code:
from tkinter import *
class teste():
def batata(self,T):
print(T)
def __init__(self):
root = Tk()
root.title("Teste")
root.geometry("800x600")
nome='Avocado'
Frame1 = Frame(root)
self.listagem=["livro","pedra"]
Frame1.grid(row = 0, column = 0,rowspan=2,sticky = W+E+N+S)
Texto1=Label(Frame1,text=self.listagem[0]).grid(row=0,column=0,rowspan=2,pady=10)
ButtCarderno1=Button(Frame1,text=self.listagem[0],command=self.batata(self.listagem[0])).grid(row=2,column=0,rowspan=2,pady=1)
root.mainloop()
teste()
If anyone knows what’s going on I thank you pk for looking for no answers