python-3.x - openfile .nc 和 .txt 等使用 wxpython
问题描述
我在我的代码中使用 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 用于 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 |*.*"
推荐阅读
- api - 将 PDF 文件作为资源上传到 CKAN 数据集失败,并显示“{file} is not json serializable”
- r - 使用 tidyverse 从日期计算年龄时出错:FUN(X[[i]], ...) 中的错误:下标越界
- javascript - E11000 重复键,猫鼬中没有重复键
- swift - 合并动态列表中未更新的发布者
- java - 命名类型 [com.go_task.entity.User@5b4d25e7] 没有实现 BasicType 和 UserType
- c++ - 从 GPU 到 RAM 的大量传输后渲染缓慢?
- git - git - 获取分支的修订而不检查它
- unix - grep 具有匹配模式的句子
- excel - 优化了我的 VBA 和错误处理程序返回输出的时间更长
- c# - 根据 if 为 2 个属性之一赋值