|
4 years ago | |
---|---|---|
.github | 4 years ago | |
.vscode | 4 years ago | |
nicegui | 4 years ago | |
sceenshots | 4 years ago | |
.gitignore | 4 years ago | |
Dockerfile | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
docker-compose.yml | 4 years ago | |
docker.sh | 4 years ago | |
main.py | 4 years ago | |
nicegui.code-workspace | 4 years ago | |
poetry.lock | 4 years ago | |
pyproject.toml | 4 years ago | |
setup.py | 4 years ago |
We like Streamlit but find it does to 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 our shot at a "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'))
Launch it with:
python3 main.py
Note: The script will automatically reload the GUI if you modify your code.
See main.py for an example of all API calls you can make with NiceGUI.
We use the Quasar Framework and hence have their full design power. Each NiceGUI element provides a design
property which content is passed as props the Quasar component:
ui.radio(['x', 'y', 'z'], design='inline color=green')
ui.button(icon='touch_app', design='outline round')
For all styling "props" as Quasar calls them have a look at their documentation.
lines = ui.line_plot(n=2, limit=20).with_legend(['sin', 'cos'], loc='upper center', ncol=2)
ui.timer(0.1, lambda: lines.push([datetime.now()], [
[np.sin(datetime.now().timestamp()) + 0.02 * np.random.randn()],
[np.cos(datetime.now().timestamp()) + 0.02 * np.random.randn()],
]))