and thank you for listening... and sorry for my bad english. I've a problem with a simple python script and i don't know how to smash my head.
That's the code. Is pretty simple and useless (i'm learning python, but my programming skills are embarissing).
import tkinter as tk
class hello:
button_state = [0,0,0,0,0,0,0,0,0]
def __init__(self):
self.root = tk.Tk()
self.button = tk.Button(self.root, text=self.button_state[0],
command=self.check(0))
self.button.pack()
def check(self,x):
if x == 0:
self.button_state[x] = 1
self.button.config(text=self.button_state[x])
app = hello()
app.root.mainloop()
and the error:
AttributeError: 'hello' object has no attribute 'button'
i don't know why if i use a label the problem dont' exist. I try and try and i think the error was in the argument call in button command?
Thanks in advance :)