Skip to content

textual_fspicker.file_save

Provides a file save dialog.

FileSave

FileSave(
    location=".",
    title="Save as",
    *,
    save_button="",
    cancel_button="",
    filters=None,
    can_overwrite=True,
    default_file=None,
)

Bases: BaseFileDialog

A file save dialog.

Parameters:

Name Type Description Default

location

str | Path

Optional starting location.

'.'

title

str

Optional title.

'Save as'

save_button

ButtonLabel

The label for the save button.

''

cancel_button

ButtonLabel

The label for the cancel button.

''

filters

Filters | None

Optional filters to show in the dialog.

None

can_overwrite

bool

Flag to say if an existing file can be overwritten.

True

default_file

str | Path | None

The default filename to place in the input.

None
Notes

open_button and cancel_button can either be strings that set the button label, or they can be functions that take the default button label as a parameter and return the label to use.

ERROR_OVERWRITE_IS_NOT_ALLOWED class-attribute instance-attribute

ERROR_OVERWRITE_IS_NOT_ALLOWED = 'Overwrite is not allowed'

The error to show if the user attempts to overwrite a file.