我在我的代码中使用openfile我需要打开nectcdf4文件和txt文件如何在我的代码中添加它:
def onOpen(self, event):
wildcard = "netCDF4 files (*.nc)|*.nc" #here need add .TXT
dialog = wx.FileDialog(self, "Open netCDF4", wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if dialog.ShowModal() == wx.ID_CANCEL:
return
path = dialog.GetPath()
我使用wxpython for python3.6
感谢帮助
您可以添加一个分号,然后添加另一个通配符字符串,例如
"Audio|*.mp3;*.wav;*.flac;*.ogg;*.dss;*.aac;*.wma;*.au;*.ra;*.dts;*.aif"
这对于创建相关文件组很有用
要么
添加另一个管道字符|
和新的通配符描述和定义,例如:
wildcard ="netCDF4 files (nc)|*.nc| Text files (txt) |*.txt| All files |*.*"