37,719
社区成员
发帖
与我相关
我的任务
分享
com_thread = threading.Thread(target=ComReci)
com_thread.start()
root.bind("<<COMRxRdy>>",lambda evt:txt1.insert("insert",Text))
def ComReci():
global Text
while True:
if COM.isOpen():
Text = COM.read(1) #read one, with timout
if Text:
n = COM.inWaiting()
if n:
Text = Text+COM.read(n)
root.event_generate("<<COMRxRdy>>",when="tail")
time.sleep(0.02)