wxpython文件打开对话框
wxpython file opening dialog
为什么这个wxpython代码会给我以下错误?
self.Bind(wx.EVT_MENU,self.onNewFile,self.New_File)
def onNewFile(self,evt):
wx.FileDialog(None,'Choose a file',os.getcwd(),"",wx.OPEN)
if dialog.ShowModal() == wx.ID_OK:
print dialog.GetPath()
dialog.Destroy()
其他设置菜单栏和创建项目的代码也在那里,但当执行时,我会得到以下错误:
Traceback (most recent call last):
File "C:Python27Front_End.py", line 52, in onNewFile
wx.FileDialog(None,'Choose a file',os.getcwd(),"",wx.OPEN)
File "C:Python27libsite-packageswx-2.8-msw-unicodewx_windows.py", line 2430, in __init__
_windows_.FileDialog_swiginit(self,_windows_.new_FileDialog(*args, **kwargs))
TypeError: String or Unicode type required
这是什么意思?
wx.FileDialog原型位于下方
__init__(self, parent, id, title, pos, size, style, name)
您可能会错过一个参数。我还将您的代码编辑如下。
def onNewFile(self,evt):
dialog = wx.FileDialog(None,'Choose a file',os.getcwd(),"", "",wx.OPEN)
if dialog.ShowModal() == wx.ID_OK:
print dialog.GetPath()
dialog.Destroy()
相关文章:
- MSDN 示例:未编译的"打开"对话框
- Qt从主窗口打开对话框
- getopenfilename功能没有打开对话框
- 如何使用Ifileopendialog打开 *模态 *文件对话框
- 使用 firebreath 插件打开文件夹对话框并异步返回文件夹选择,这样 java 脚本就不会被阻止
- VC++ 2010:从 VC6++ 转换后显示打开对话框时出错
- 在 MFC C++中打开对话框
- 如何设置 windows 文件打开对话框筛选器以包含"必须完成"选项
- MFC 菜单项未打开对话框
- 我的命名空间扩展未在“文件打开”对话框中列出
- Qt应用程序在使用文件打开对话框后将焦点切换到其他应用程序
- wxpython文件打开对话框
- 按条件打开对话框
- 打开对话框
- Qt鼠标光标不改变时,打开对话框后下降事件
- 打开对话框
- MSDN打开对话框示例代码
- Win32 API:打开对话框窗口后应用程序冻结
- 点击Visual c++时打开对话框按钮
- C++/Qt-从主窗口打开对话框-错误LNK2019-LNK2001:未解析的外部符号