Skip to content

Introduction

This library brings a simple set of filesystem-oriented dialogs to Textual applications. If you have a need to give your users a dialog that lets them pick a file for opening, a file for saving, or they need to pick a directory, this might be the library for you.

Examples

Opening a file

OpenAFileApp  Open ─────────────────────────────────────────────────────── 📁 ..                         1280 2025-02-08 07:40:38 📁 dist                        128 2025-02-19 23:06:05 📁 docs                        128 2025-02-27 21:21:27 📁 img                          96 2023-05-18 20:57:17 📁 src                          96 2025-01-15 22:22:32 📄 ChangeLog.md               4127 2025-02-20 21:33:59 📄 LICENSE                    1087 2023-05-14 18:22:29 📄 Makefile                   3577 2025-02-27 21:21:27▂▂ 📄 README.md                  1810 2025-01-15 22:22:32 📄 mkdocs.yml                 2044 2025-02-27 21:21:27 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ OpenCancel ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ──────────────────────────────────────────────────────────────

from textual import work
from textual.app import App

from textual_fspicker import FileOpen


class OpenAFileApp(App[None]):
    @work
    async def on_mount(self) -> None:
        await self.push_screen_wait(FileOpen())


if __name__ == "__main__":
    OpenAFileApp().run()

Saving a file

SaveAFileApp  Save as ──────────────────────────────────────────────────── 📁 ..                         1280 2025-02-08 07:40:38 📁 dist                        128 2025-02-19 23:06:05 📁 docs                        128 2025-02-27 21:21:27 📁 img                          96 2023-05-18 20:57:17 📁 src                          96 2025-01-15 22:22:32 📄 ChangeLog.md               4127 2025-02-20 21:33:59 📄 LICENSE                    1087 2023-05-14 18:22:29 📄 Makefile                   3577 2025-02-27 21:21:27▂▂ 📄 README.md                  1810 2025-01-15 22:22:32 📄 mkdocs.yml                 2044 2025-02-27 21:21:27 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ SaveCancel ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ──────────────────────────────────────────────────────────────

from textual import work
from textual.app import App

from textual_fspicker import FileSave


class SaveAFileApp(App[None]):
    @work
    async def on_mount(self) -> None:
        await self.push_screen_wait(FileSave())


if __name__ == "__main__":
    SaveAFileApp().run()

Selecting a directory

SelectADirectoryApp  Select directory ─────────────────────────────────────────── 📁 ..                           1280 2025-02-08 07:40:38 📁 dist                          128 2025-02-19 23:06:05 📁 docs                          128 2025-02-27 21:21:27 📁 img                            96 2023-05-18 20:57:17 📁 src                            96 2025-01-15 22:22:32 ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ …ython/textual-fspickerSelectCancel ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ──────────────────────────────────────────────────────────────

from textual import work
from textual.app import App

from textual_fspicker import SelectDirectory


class SelectADirectoryApp(App[None]):
    @work
    async def on_mount(self) -> None:
        await self.push_screen_wait(SelectDirectory())


if __name__ == "__main__":
    SelectADirectoryApp().run()