Here is my code snippet:
class Window(ttk.Frame):
def __init__(self, master=None):
super().__init__(master)
global T1
self.frame = ttk.Frame(padding="3 3")
self.frame = ttk.Frame(borderwidth = 5, relief = 'ridge')
self.frame.grid(column=1,row=1, sticky=('news'))
self.frame.grid_columnconfigure(0, weight=1)
self.frame.grid_rowconfigure(0, weight=1)
style = ttk.Style()
style.configure('my.TButton', font=('Helvetica', 46))
T1 = ttk.Button(self.frame, text="Test 1", style='my.TButton',
command=start1).grid(column=1,row=1, sticky=())
window = Window()
window.master.title("Recording")
window.master.mainloop()
When I call the 'start1' function:
def start1():
global running, f
running = True
T1.configure(state="disabled")
f = open("Test_1.txt", "w")
recording()
I always get the following error message:
Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.4/tkinter/init.py", line 1536, in __call__return self.func(*args) File "/home/pi/Public/Test_DataRecording.py", line 40, in start1 T1.configure(state="disabled") AttributeError: 'NoneType' object has no attribute 'configure'
Somehow T1 is not recognized as a button... Please take care in your answer as I am a bloody Python-beginner