我是Python新手,正在尝试使用标签创建接口。
标签包含已连接和已断开连接的消息。你知道吗
from Tkinter import *
root = Tk()
def connectToArduino():
arduino = serial.Serial(arduinoPort, serialTransferRate)
arduino.timeout = None
time.sleep(2)
arduino.write("S\n")
Label(root, text="Connected")
return arduino
arduino = connectToArduino()
arduino.pack()
root.mainloop()
如何使用if-else条件在标签处添加已连接/已断开连接的邮件?你知道吗
必须将标签的ID存储在变量中
然后你可以使用
在测试并发现其已断开连接的代码中。你知道吗
相关问题 更多 >
编程相关推荐