我正在使用 Python 和 wxPython 在我的用户和 USB 设备之间进行交互。USB 设备在处理命令方面有些慢。因此,在发送命令后,我会显示一个对话框,通知用户该命令并给设备足够的时间来处理该命令。编码:
def ActionOnButtonClick( self, event ):
# Send command to USB device;
device.Send("command")
# Notify user + allowing device to process command;
dlg = wx.MessageDialog(parent=None, message="Info", caption="Info", style=wx.OK)
dlg.ShowModal()
dlg.Destroy()
# Start timer;
self.RunTimer.Start(500)
当我像这样运行代码时,“RunTimer”只会运行一次。经过一些测试,我注意到当我删除消息对话框时,RunTimer 将连续运行而没有任何问题。
我无法弄清楚我做错了什么。有什么想法/想法吗?
预先感谢您的回答!
此致,
彼得