|
3 ani în urmă | |
---|---|---|
.github | 3 ani în urmă | |
.vscode | 4 ani în urmă | |
nicegui | 3 ani în urmă | |
sceenshots | 4 ani în urmă | |
.gitignore | 3 ani în urmă | |
LICENSE | 4 ani în urmă | |
README.md | 3 ani în urmă | |
custom_test.py | 4 ani în urmă | |
development.dockerfile | 3 ani în urmă | |
docker-compose.yml | 3 ani în urmă | |
docker.sh | 3 ani în urmă | |
examples.py | 3 ani în urmă | |
main.py | 3 ani în urmă | |
nicegui.code-workspace | 4 ani în urmă | |
poetry.lock | 3 ani în urmă | |
pyproject.toml | 3 ani în urmă | |
release.dockerfile | 4 ani în urmă |
NiceGUI is an easy to use, Python-based UI framework, which renderes to the web browser. You can create buttons, dialogs, markdown, 3D scences, plots and much more.
It was designed to be used for micro web apps, dashboards, robotics projects, smart home solutions and similar use cases. It is also helpful for development, for example when tweaking/configuring a machine learning algorithm or tuning motor controllers.
python3 -m pip install nicegui
Write your nice GUI in a file main.py
:
from nicegui import ui
ui.label('Hello NiceGUI!')
ui.button('BUTTON', on_click=lambda: print('button was pressed', flush=True))
ui.run()
Launch it with:
python3 main.py
The GUI is now avaliable through http://localhost/ in your browser. Note: The script will automatically reload the page when you modify the code.
You can call ui.run()
with optional arguments for some high-level configuration:
host
(default: '0.0.0.0'
)port
(default: 80
)title
(default: 'NiceGUI'
)favicon
(default: 'favicon.ico'
)reload
: automatically reload the ui on file changes (default: True
)show
: automatically open the ui in a browser tab (default: True
)uvicorn_logging_level
: logging level for uvicorn server (default: 'warning'
)interactive
: used internally when run in interactive Python shell (default: False
)Use the multi-arch docker image for pain-free installation:
docker run --rm -p 8888:80 -v $(pwd)/my_script.py:/app/main.py -it zauberzeug/nicegui:latest
This will start the server at http://localhost:8888 with code from my_script.py
within the current directory.
Code modification triggers an automatic reload.
We like Streamlit but find it does too much magic when it comes to state handling. In search for an alernative nice library to write simple graphical user interfaces in Python we discovered justpy. While too "low-level HTML" for our daily usage it provides a great basis for "NiceGUI".
The API reference is hosted at https://nicegui.io and is implemented with NiceGUI itself. You should also have a look at examples.py for an extensive demonstration of what you can do with NiceGUI.