我可爱的自定义Progress类更多问题转移到wx python 3(第一部分见wx python 3.0.2 classic SetFocus blows)
此:
def setCancel(self, enabled=True):
cancel = self.dialog.FindWindowById(wx.ID_CANCEL)
cancel.Enable(enabled)
用于在2.8.12.1 unicode中正常工作,而在3.02中使用:
崩溃Traceback (most recent call last):
File "bash\balt.py", line 419, in <lambda>
if onButClick: self.Bind(wx.EVT_BUTTON, lambda __event: onButClick())
File "bash\balt.py", line 1565, in _conversation_wrapper
return func(*args, **kwargs)
File "bash\basher\patcher_dialog.py", line 204, in PatchExecute
progress.setCancel(False)
File "bash\balt.py", line 1317, in setCancel
cancel.Enable(enabled)
AttributeError: 'NoneType' object has no attribute 'Enable'
self.dialog
是wx.ProgressDialog
。我在How to override the “Cancel” button event of a ProgressDialog?
我怀疑原生小部件根本不允许您访问取消按钮,但我不确定。
从answer @RobinDunn到我之前的问题:
在Windows上,ProgressDialog [...] 没有本机窗口句柄,并且大多数非ProgressDialog特定的API(如SetFocus)都不起作用。
(强调我的)
这是否意味着我无法再禁用进度对话框的取消按钮?