FileDialog#
- class ignis.widgets.Widget.FileDialog(*args: Any, **kwargs: Any)#
Bases: Gtk.FileDialog.
Danger
This is not a regular widget. It doesn't support common widget properties and cannot be added as a child to a container.
A window that allows the user to select a file.
- Signals:
"file-set" (
Gio.File
): Emitted when a file or folder is selected.
- Properties:
file (
Gio.File | None
, not argument, read-only): The selectedGio.File
.on_file_set (
Callable
, optional, read-write): A function to call when user selects a file.filters (list[
FileFilter
], optional, read-write): A list of file filters.initial_path (
str
, optional, read-write): The path to the folder or file that will be selected by default.select_folder (
bool
, optional, read-write): Whether the dialog should allow selecting folders instead of files.
Hint
Use the
get_path
method on theGio.File
to get the path.Widget.FileDialog( initial_path=os.path.expanduser("~/.config"), on_file_set=lambda self, file: print(file.get_path()), select_folder=False, filters=[ Widget.FileFilter( mime_types=["image/jpeg", "image/png"], default=True, name="Images JPEG/PNG", ) ] )
- open_dialog() None #
Open dialog.