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
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
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
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()