Reputation: 454
I am using the gi.repository.Gtk
module to generate some GUIs.
To let the user select a folder I use the gi.repository.Gtk.FileChooserButton
.
According to the Gtk3 documentation I should be able to select or create folders using the action Gtk.FileChooserAction.SELECT_FOLDER
or Gtk.FileChooserAction.CREATE_FOLDER
.
So the relevant code is this:
filechooser = Gtk.FileChooserButton(Gtk.FileChooserAction.CREATE_FOLDER)
filechooser.connect("file-set",update_select_folder)
def update_select_folder(*args):
print(*args)
But I am still unable to select/create folders.( I am able to select files.)
So my Question is: How can I select/create folders using a FileChooserButton?
Upvotes: 1
Views: 264
Reputation: 2250
From https://developer.gnome.org/gtk3/stable/GtkFileChooser.html
filechooser = Gtk.FileChooserButton()
filechooser.set_action(Gtk.FileChooserAction.SELECT_FOLDER)
filechooser.set_create_folders(True)
Upvotes: 2