Skip to main content

Web User Interface with Buttons, Dialogs, Markdown, 3D Scences and Plots

Project description

NiceGUI

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.

Features

  • browser-based graphical user interface
  • shared state between multiple browser windows
  • implicit reload on code change
  • standard GUI elements like label, button, checkbox, switch, slider, input, file upload, ...
  • simple grouping with rows, columns, cards and dialogs
  • general-purpose HTML and markdown elements
  • powerful elements to plot graphs, render 3D scences and get steering events via virtual joysticks
  • built-in timer to refresh data in intervals (even every 10 ms)
  • straight-forward data binding to write even less code
  • notifications, dialogs and menus to provide state of the art user interaction

Installation

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', 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.

Configuration

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)

Docker

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.

Why?

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

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nicegui-0.6.12.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nicegui-0.6.12-py3-none-any.whl (4.6 MB view details)

Uploaded Python 3

File details

Details for the file nicegui-0.6.12.tar.gz.

File metadata

  • Download URL: nicegui-0.6.12.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for nicegui-0.6.12.tar.gz
Algorithm Hash digest
SHA256 139251288526bc267b895263dbe877cda897b021fc6c0f12357836635d8cd15f
MD5 e015850d96d821c61fcec314f184ba00
BLAKE2b-256 efe56f1e9dd002accbd2d602cfb143f29c86ef6046fc06d8926ac1c790298a05

See more details on using hashes here.

File details

Details for the file nicegui-0.6.12-py3-none-any.whl.

File metadata

  • Download URL: nicegui-0.6.12-py3-none-any.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for nicegui-0.6.12-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf66393a196668cf58d123fca8c5e7e05a4214e75ca1fe025430855f5834d94
MD5 d35dd1526546b2462fad9fa4debf67f0
BLAKE2b-256 ff28a942a57ca9c4fa20adf537863586e8416e13aa54bb398a91fe108ee9bb44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page