制作 PythonCard 文件对话框单选?
我正在开发一个 python 应用程序,并选择使用 PythonCard 构建 gui。我需要让用户选择要打开的文件,在上下文中,选择多个文件没有意义。我可以成功创建一个文件 dioalog 并且
dialog.fileDialog(self, 'Open Input File', '', '')
我想我需要使用可选的样式参数才能获得 sinlge 选择对话框,但我找不到需要传递给第五个参数的示例或文档为了获得单个选择文件对话框。
I'm working on a python application and have chosen to build the gui with PythonCard. I have need to have the user select a file to open, and in the context, selecting more than 1 file doesn't make sense. I can successfully create a file dioalog with
dialog.fileDialog(self, 'Open Input File', '', '')
And I would imagine I need to use the optional style parameter in order to get a sinlge select dialog, but I can't find an example or documentation of what I need to pass to the fifth param in order to get a single select file dialog.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将最后一行设置为 wx.OPEN - 应该就是这样。看来PythonCard将对话框的主要样式指定为wx.OPEN | wx.MULTIPLE,因此覆盖它以仅打开应该可以解决问题。
Try setting the last line to wx.OPEN - that should be it. It seems that PythonCard specifies a dialog's main style as wx.OPEN | wx.MULTIPLE, so overriding it to just open should do the trick.
以下是 PythonCard 对话框的参考:
pythoncard.sourceforge.net/dialogs
它提供了每种对话框类型的参数的解释并附有示例。
Here's a reference for PythonCard dialogs:
pythoncard.sourceforge.net/dialogs
It provides an explanation of the arguments for each dialog type along with examples.