Make FileChooserDialog allow the user to select a folder / directory

Is it possible to install gtk.FileChooserDialog / gtk.FileChooserButton only so that users can select a folder / directory?

Maybe I will add a directory filter for this? How can I do this so that the user can select only the folder?

email_dialog = gtk.FileChooserDialog(title="Select folder", buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) email_filter = gtk.FileFilter() email_filter.set_name("Folder") email_filter.add_pattern("*") # whats the pattern for a folder email_dialog.add_filter(email_filter) 
+4
source share
1 answer
 email_dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) 

The documentation is here .

+8
source

Source: https://habr.com/ru/post/1415786/


All Articles