在使用wx的时候,报错AttributeError: ‘module’ object has no attribute ‘OPEN’
这个主要是由于新旧版本不同所致
在旧版中
dlg = wx.FileDialog(
self, message="Choose a file",
defaultDir=self.currentFolder,
defaultFile="",
wildcard=wildcard,
style=wx.OPEN | wx.CHANGE_DIR
)
然而从2.8.9.2版开始
The correct constant to use is wx.FD_OPEN instead of wx.OPEN, the later may have worked in older wxPython versions. But even documentation for version 2.8.9.2 says wx.FD_OPEN.
新版本的写法
dlg = wx.FileDialog(
self, message="Choose a file",
defaultDir=self.currentFolder,
defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_CHANGE_DIR
)
换一下就好了