Create a new Flet app
Create a new directory (or directory with pyproject.toml
already exists if initialized with poetry
or uv
) and switch into it.
To create a new "minimal" Flet app run the following command:
- venv
- uv
- poetry
flet create
uv run flet create
poetry run flet create
The command will create the following directory structure:
├── README.md
├── pyproject.toml
├── src
│ ├── assets
│ │ └── icon.png
│ └── main.py
└── storage
├── data
└── temp
note
- Original
pyproject.toml
created byuv init
orpoetry init
will be replaced with the one from Flet app template. - In case you encounter the error
Error creating the project from a template: 'git' is not installed.
, it means that you don't have Git installed. Please visit git-scm.com/downloads and install the latest version of Git. To verify your installation, typegit
in the terminal. Please note that Git is not the same as GitHub CLI which is not an alternative for use with Flet.
src/main.py
contains Flet program. It has main()
function where you would add UI elements (controls) to a page or a window. The application ends with a blocking ft.app()
function which initializes Flet app and runs main()
.
You can find more information about flet create
command here.
Now let's see Flet in action by running the app!