import serial import threading import time from tkinter import * root=Tk() root.title('Usart-stm32') root.geometry('250x250') root['bg']='blue' v = StringVar() tex=Text(root,width=20,height=2, font='Verdana 12', wrap=WORD) def get1(event,*args,**kwargs): threading.Timer(1.0, get1).start() time.sleep(2.0) print ("hello") but3=Button(root,text='Hello') but3.bind('<Button-1>',get1) ent1 = Entry (root, textvariable = v,bg="black",fg="white",font=20,width=20,bd=20) ent1.pack() tex.pack() but3.pack() root.mainloop()
Сыплются ошибки при вызове функции get1
Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\111\AppData\Local\Programs\Python\Python35-32\lib\threading.py", line 914, in _bootstrap_inner self.run() File "C:\Users\111\AppData\Local\Programs\Python\Python35-32\lib\threading.py", line 1180, in run self.function(*self.args, **self.kwargs) TypeError: get1() missing 1 required positional argument: 'event' hello
Может это больше проблема tkinter..