Tkinter and detection of USB devices

喜欢而已 提交于 2019-12-22 18:13:39

问题


I would like to monitor the presence of USB devices and have found modules such as PyUSB that serve this purpose. However, I don't know how to run USB detection services alongside the Tkinter main loop. Is this possible?


回答1:


Before starting tk mainloop, start some separate thread that will monitor USBs. Or you can try using tk alarms http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm to periodically check USB.




回答2:


Might I suggest that instead of trying to constantly monitor the presence of a USB device you include a search or refresh button that will check just once.



来源:https://stackoverflow.com/questions/5453256/tkinter-and-detection-of-usb-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!