Skip to content

PathTag

mininterface.tag.PathTag

Contains a Path or their list. Use this helper object to select files.

In the following example, we see that it is not always needed to use this object.

  • File 1 – plain detection, button to a file picker appeared.
  • File 2 – the same.
  • File 3 – we specified multiple paths can be selected.
from pathlib import Path
from mininterface import run, Tag
from mininterface.tag import PathTag

m = run()
out = m.form({
    "File 1": Path("/tmp"),
    "File 2": Tag("", annotation=Path),
    "File 3": PathTag([Path("/tmp")], multiple=True),
})
print(out)
# {'File 1': PosixPath('/tmp'), 'File 2': PosixPath('.')}
# {'File 3': [PosixPath('/tmp')]}

File picker

multiple: Optional[bool] = None

The user can select multiple files.

exist: Optional[bool] = None

If True, validates that the selected file exists

is_dir: Optional[bool] = None

If True, validates that the selected path is a directory

is_file: Optional[bool] = None

If True, validates that the selected path is a file