快速搭建web见面

Rodja Trappe a15e8d749d Merge branch 'main' of github.com:zauberzeug/nicegui into main 4 years ago
.github fc127dc4fe trying to make automated pypi releases with poetry 4 years ago
.vscode 852faab6b1 do not set blank lines 4 years ago
nicegui 330bd3d787 Merge branch 'main' of github.com:zauberzeug/nicegui into main 4 years ago
sceenshots 02e770f4c1 adding docs for some interactive elements 4 years ago
.gitignore 11844e40cc cleanup 4 years ago
LICENSE 0cb68ea25c Adding license 4 years ago
README.md 7ce49e5b09 example on main page 4 years ago
development.dockerfile c21d1a6d7b preparing for release dockerfile 4 years ago
docker-compose.yml c21d1a6d7b preparing for release dockerfile 4 years ago
docker.sh 627296fbd6 simplified docker.sh 4 years ago
examples.py 4c49010f39 allow activating and deactivating a timer 4 years ago
main.py a15e8d749d Merge branch 'main' of github.com:zauberzeug/nicegui into main 4 years ago
nicegui.code-workspace e11050e6f3 made dev container debuggable 4 years ago
poetry.lock ca145254d4 asttokens are a release requirement 4 years ago
pyproject.toml ca145254d4 asttokens are a release requirement 4 years ago
release.dockerfile 974927a6f1 new release 4 years ago

README.md

NiceGUI

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 "NiceGUI".

Purpose

NiceGUI is intended to be used for small scripts and single-page user interfaces with a very limited user base. Like smart home solutions, micro web apps or robotics projects. It's also helpful for development, when tweaking/configuring a machine learning training or tuning motor controllers.

Features

  • browser-based Graphical User Interface
  • shared state between multiple browser windows
  • implicit reload on code change
  • clean set of GUI elements (label, button, checkbox, switch, slider, input, ...)
  • simple grouping with rows, columns and cards
  • genral-purpose html and markdown elements
  • built-in timer to refresh data in intervals (even every 10 ms)
  • straight-forward data bindings to write even less code

Install

python3 -m pip install nicegui

Usage

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

The GUI is now avaliable thorugh http://localhost/ in your browser. Note: The script will automatically reload the page if you modify the code.

API

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.