I'm trying to use FileChooserButton to get the path to folder selected by the user. I've read the documentation on FCB and I think I should use get_current_folder() but when I do that i get a global name error. As far as I know, get_current_folder() should already be defined in the FCB method, and should not be defined again.

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

This piece of code returns the following error:

NameError: global name 'get_current_folder' is not defined

Am I missing something? I've even considered scrapping FileChooser for a simple text filed where the user types in the path, but that would be pointless for the app I'm working on.

有帮助吗?

解决方案

I think this is what you are looking for:

def on_fromdialog_current_folder_changed(self, widget):
    print widget.get_current_folder()
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top