问题描述
我可以通过 hm-10 将数据从我的电脑发送到 arduino。但是我如何将 bleak 库与 tkinter 库一起使用?
async def run(address):
async with BleakClient(address) as client:
async def ehyyy():
await client.write_gatt_char(MODEL_NBR_UUID,b"hello")
main = Tk()
main.title("app")
main.geometry("700x500")
main.resizable("false","false")
main.configure(background='#595959')
Nsonglogo = PhotoImage(file="logos/dot.png")
buttonNsong = Button(main,border= 0,command=ehyyy,bg ="#595959",image =Nsonglogo,activebackground="#595959")
buttonNsong.pack()
buttonNsong.place(x=402,y=380)
main.mainloop()
loop = asyncio.get_event_loop()
loop.run_until_complete(run(address))
当我点击按钮时,我接受了那个错误:
coroutine 'run.<locals>.ehyyy' was never awaited
self.tk.mainloop(n)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)