# Flet for Pyodide - build standalone Single-Page Applications (SPA) in Python with Flutter UI
[Flet](https://flet.dev) is a rich User Interface (UI) framework to quickly build interactive web, desktop and mobile apps in Python without prior knowledge of web technologies like HTTP, HTML, CSS or JavaSscript. You build UI with [controls](https://flet.dev/docs/controls) based on [Flutter](https://flutter.dev/) widgets to ensure your programs look cool and professional.
## Requirements
* Python 3.7 or above on Windows, Linux or macOS
## Installation
```
pip install flet
```
## Create the app
Create `main.py` file with the following content:
```python
import flet as ft
def main(page: ft.Page):
page.title = "Flet counter example"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
txt_number = ft.TextField(value="0", text_align=ft.TextAlign.RIGHT, width=100)
def minus_click(e):
txt_number.value = str(int(txt_number.value) - 1)
page.update()
def plus_click(e):
txt_number.value = str(int(txt_number.value) + 1)
page.update()
page.add(
ft.Row(
[
ft.IconButton(ft.icons.REMOVE, on_click=minus_click),
txt_number,
ft.IconButton(ft.icons.ADD, on_click=plus_click),
],
alignment=ft.MainAxisAlignment.CENTER,
)
)
ft.app(main)
```
## Run the app
```
flet run --web main.py
```
![Sample app in a browser](https://flet.dev/img/docs/getting-started/flet-counter-safari.png)
## Publish app as a static website
```
flet publish main.py
```
A static website is published into `./dist` directory.
## Test website
```
python -m http.server --directory dist
```
Open `http://localhost:8000` in your browser to check the published website.
## Deploy website
Deploy a static website to any free hosting such as GitHub Pages, Cloudflare Pages or Vercel!
## Learn more
Visit [Flet website](https://flet.dev).
Continue with [Python guide](https://flet.dev/docs/getting-started/python) to learn how to make a real app.
Browse for more [Flet examples](https://github.com/flet-dev/examples/tree/main/python).
Join to a conversation on [Flet Discord server](https://discord.gg/dzWXP8SHG8).
Raw data
{
"_id": null,
"home_page": null,
"name": "flet-contrib-pyodide",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Appveyor Systems Inc.",
"author_email": "hello@flet.dev",
"download_url": "https://files.pythonhosted.org/packages/1a/56/9ef7aefe7e93b3ca7d6330d7405598e2e9d5656efe1992ae05634a25e951/flet_contrib_pyodide-2024.12.7.2153.tar.gz",
"platform": null,
"description": "# Flet for Pyodide - build standalone Single-Page Applications (SPA) in Python with Flutter UI\n\n[Flet](https://flet.dev) is a rich User Interface (UI) framework to quickly build interactive web, desktop and mobile apps in Python without prior knowledge of web technologies like HTTP, HTML, CSS or JavaSscript. You build UI with [controls](https://flet.dev/docs/controls) based on [Flutter](https://flutter.dev/) widgets to ensure your programs look cool and professional.\n\n## Requirements\n\n* Python 3.7 or above on Windows, Linux or macOS\n\n## Installation\n\n```\npip install flet\n```\n\n## Create the app\n\nCreate `main.py` file with the following content:\n\n```python\nimport flet as ft\n\ndef main(page: ft.Page):\n page.title = \"Flet counter example\"\n page.vertical_alignment = ft.MainAxisAlignment.CENTER\n\n txt_number = ft.TextField(value=\"0\", text_align=ft.TextAlign.RIGHT, width=100)\n\n def minus_click(e):\n txt_number.value = str(int(txt_number.value) - 1)\n page.update()\n\n def plus_click(e):\n txt_number.value = str(int(txt_number.value) + 1)\n page.update()\n\n page.add(\n ft.Row(\n [\n ft.IconButton(ft.icons.REMOVE, on_click=minus_click),\n txt_number,\n ft.IconButton(ft.icons.ADD, on_click=plus_click),\n ],\n alignment=ft.MainAxisAlignment.CENTER,\n )\n )\n\nft.app(main)\n```\n\n## Run the app\n\n```\nflet run --web main.py\n```\n\n![Sample app in a browser](https://flet.dev/img/docs/getting-started/flet-counter-safari.png)\n\n## Publish app as a static website\n\n```\nflet publish main.py\n```\n\nA static website is published into `./dist` directory.\n\n## Test website\n\n```\npython -m http.server --directory dist\n```\n\nOpen `http://localhost:8000` in your browser to check the published website.\n\n## Deploy website\n\nDeploy a static website to any free hosting such as GitHub Pages, Cloudflare Pages or Vercel!\n\n## Learn more\n\nVisit [Flet website](https://flet.dev).\n\nContinue with [Python guide](https://flet.dev/docs/getting-started/python) to learn how to make a real app.\n\nBrowse for more [Flet examples](https://github.com/flet-dev/examples/tree/main/python).\n\nJoin to a conversation on [Flet Discord server](https://discord.gg/dzWXP8SHG8).\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Flet for Pyodide - build standalone SPA in Python with Flutter UI.",
"version": "2024.12.7.2153",
"project_urls": {
"documentation": "https://flet.dev/docs",
"homepage": "https://flet.dev",
"repository": "https://github.com/flet-dev/flet"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d0b8c12d3815dec2155b81e60452640085fd9931270640ed4a686e374179796d",
"md5": "f9c237b7dd86a956d00038af94e3b823",
"sha256": "c9d6cf8999b4d21c77ef0ae06e68f78a10140f84cec9de630f4d1401ef4ececd"
},
"downloads": -1,
"filename": "flet_contrib_pyodide-2024.12.7.2153-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9c237b7dd86a956d00038af94e3b823",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 5461,
"upload_time": "2024-12-07T21:53:43",
"upload_time_iso_8601": "2024-12-07T21:53:43.921933Z",
"url": "https://files.pythonhosted.org/packages/d0/b8/c12d3815dec2155b81e60452640085fd9931270640ed4a686e374179796d/flet_contrib_pyodide-2024.12.7.2153-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1a569ef7aefe7e93b3ca7d6330d7405598e2e9d5656efe1992ae05634a25e951",
"md5": "237c89f77a30769c783521848c1fea74",
"sha256": "45ba430aeb51e9df72b9e83ca39f0ad1f43c139cb58567fac0ddfac20450ee50"
},
"downloads": -1,
"filename": "flet_contrib_pyodide-2024.12.7.2153.tar.gz",
"has_sig": false,
"md5_digest": "237c89f77a30769c783521848c1fea74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4147,
"upload_time": "2024-12-07T21:53:50",
"upload_time_iso_8601": "2024-12-07T21:53:50.810250Z",
"url": "https://files.pythonhosted.org/packages/1a/56/9ef7aefe7e93b3ca7d6330d7405598e2e9d5656efe1992ae05634a25e951/flet_contrib_pyodide-2024.12.7.2153.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-07 21:53:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flet-dev",
"github_project": "flet",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"appveyor": true,
"lcname": "flet-contrib-pyodide"
}