Skip to content

textual_fspicker.file_dialog

Base file-oriented dialog.

BaseFileDialog

BaseFileDialog(
    location=".",
    title="Open",
    select_button="",
    cancel_button="",
    *,
    filters=None,
    default_file=None,
)

Bases: FileSystemPickerScreen

The base dialog for file-oriented picking dialogs.

Parameters:

Name Type Description Default

location

str | Path

Optional starting location.

'.'

title

str

Optional title.

'Open'

select_button

ButtonLabel

The label for the select button.

''

cancel_button

ButtonLabel

The label for the cancel button.

''

filters

Filters | None

Optional filters to show in the dialog.

None

default_file

str | Path | None

The default filename to place in the input.

None

ERROR_A_FILE_MUST_BE_CHOSEN class-attribute instance-attribute

ERROR_A_FILE_MUST_BE_CHOSEN = 'A file must be chosen'

An error to show the user when a file should be chosen.

FileFilter

Bases: Select[int]

The file type filtering widget.

This widget provides a file filter drop-down selection for all dialogs that inherit from BaseFileDialog.