以下のようなクラスを作成します。しかし、「ファイルを保存」ボタンでイベントをバインドすると、wx.filelog がセットアップされません。本当に変です。SuperClass を wx.Frame に変更すると、成功します。理由を教えてもらえますか? ありがとう。
class TestDialog(wx.Dialog):
def __init__(
self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE,
useMetal=False,):
self.pre = wx.PreDialog()
self.pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
self.pre.Create(parent, ID, title, pos, size, style)
self.PostCreate(self.pre)
self.fileButton = wx.Button(self , -1, "save file!")
self.Bind(wx.EVT_BUTTON, self.OnCompressToFileButton, self.fileButton)
def OnCompressToFileButton(self, event):
wildcard = "compress file(*.cof)|*.cof|Lempel-Zivsliding window compressfile(*.lz)|*.lz"
dlg = wx.FileDialog(self, message="Save file as ...", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.SAVE)
`