
Note that old versions of the file chooser’s documentation suggested using Gtk.FileChooser::set_current_folder() in various situations, with the intention of letting the application suggest a reasonable default folder. Use ,Īnd set the existing filename with Gtk.FileChooser::set_filename(). Use ,Īnd suggest a name such as Untitled with Gtk.FileChooser::set_current_name(). There are various cases in which you may need to use a Gtk.FileChooserDialog: To use a dialog for saving, you can use this: def on_save(self, event): #_label(os.path.basename(file_path))Įlif response = : In the simplest of cases, you can the following code to use Gtk.FileChooserDialog to select a file for opening: def on_open(self, event):ĭialog = Gtk.FileChooserDialog("Please choose a file", self.win, Instead, you should use the functions that work on a Gtk.FileChooser.


Note that Gtk.FileChooserDialog does not have any methods of its own. It exposes the Gtk.FileChooser interface, so you can use all of the Gtk.FileChooser functions on the file chooser dialog as well as those for Gtk.Dialog. This widget works by putting a Gtk.FileChooserWidget inside a GtkDialog.

Gtk.FileChooserDialog is a dialog box suitable for use with File/Open or File/Save as commands. Gtk.FileChooserDialog - A file chooser dialog, suitable for “File/Open” or “File/Save” commands
