【问题标题】:How to receive the folder from FileChooserButton [PyGTK]如何从 FileChooserButton [PyGTK] 接收文件夹
【发布时间】:2013-03-23 15:55:28
【问题描述】:

我正在尝试使用 FileChooserButton 来获取用户选择的文件夹的路径。我已经阅读了有关 FCB 的文档,我认为我应该使用 get_current_folder() 但是当我这样做时,我得到一个全局名称错误。据我所知,get_current_folder()应该已经在FCB方法中定义了,不应该再定义了。

    def on_fromdialog_current_folder_changed(self, widget):
    print get_current_folder()

这段代码返回如下错误:

NameError: global name 'get_current_folder' is not defined

我错过了什么吗?我什至考虑放弃 FileChooser 以获得用户在路径中键入的简单文本文件,但这对于我正在开发的应用程序来说毫无意义。

【问题讨论】:

    标签: pygtk filechooser


    【解决方案1】:

    我想这就是你要找的:

    def on_fromdialog_current_folder_changed(self, widget):
        print widget.get_current_folder()
    

    【讨论】:

    • 做到了!谢谢,我不知道为什么我自己没有想到这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多