Skip to main content

High-Level Abstraction Web-GUI Using Just Python

Project description

NiceGUI

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

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
  • general-purpose HTML and markdown elements
  • built-in timer to refresh data in intervals (even every 10 ms)
  • straight-forward data binding to write even less code

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)

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.

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.4.13.tar.gz (4.4 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.4.13-py3-none-any.whl (4.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nicegui-0.4.13.tar.gz
  • Upload date:
  • Size: 4.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.6 Linux/5.8.0-1036-azure

File hashes

Hashes for nicegui-0.4.13.tar.gz
Algorithm Hash digest
SHA256 be14a2422dc15f1f288016945048a3fb2a6d4d9c1aada78bb3acf4868f6a6ed1
MD5 09c1b8a1e4bbd99ca5c4ea60e9b8ff79
BLAKE2b-256 c5f11e7469bb9c7c5414009572e93926a7bbb03cbfb9ebebd4322ac96e9fa0e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nicegui-0.4.13-py3-none-any.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.6 Linux/5.8.0-1036-azure

File hashes

Hashes for nicegui-0.4.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1e825e37d4ea210df0b9b6af053b46e24cb6e853f70bb96f84df4a73d7c0bb04
MD5 397ec7b28972973f8c96c0b50d155593
BLAKE2b-256 6d852f1605fb3e020220b61caada2d159d13c540075bc68701b3c22f0951d111

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