textual_fspicker.file_open
Provides a file opening dialog.
FileOpen
FileOpen(
location=".",
title="Open",
*,
open_button="",
cancel_button="",
filters=None,
must_exist=True,
default_file=None,
)
Bases: BaseFileDialog
A file opening dialog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str | Path
|
Optional starting location. |
'.'
|
|
str
|
Optional title. |
'Open'
|
|
ButtonLabel
|
The label for the open button. |
''
|
|
ButtonLabel
|
The label for the cancel button. |
''
|
|
Filters | None
|
Optional filters to show in the dialog. |
None
|
|
bool
|
Flag to say if the file must exist. |
True
|
|
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_A_FILE_MUST_EXIST
class-attribute
instance-attribute
ERROR_A_FILE_MUST_EXIST = 'The file must exist'
An error to show a user when a file must exist.