如何解决Pyhton 黯淡和 tkinter
我可以通过 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 举报,一经查实,本站将立刻删除。