我想知道如何在 openfiledialog 打开时更改目录。我想将其设置为特定目录。
def OnOpen(self,event):
"""Open a file"""
openFileDialog = wx.FileDialog(self,"Open log file","","","Log files (*.log)|*.log",wx.FD_OPEN | wx.FD_FILE_MUST_EXIST |wx.FD_CHANGE_DIR)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return
input_stream = wx.FileInputStream(openFileDialog.GetPath())
if not input_stream.IsOk():
wx.LogError("Cannot open file '%s'."%openFileDialog.GetPath())
return
我看到了诸如 setdirectory 之类的函数。我不知道在哪里应用该参数。