nicegui README

The project's README from github.com/zauberzeug/nicegui. As one markdown file: README.md.

Try online!

NiceGUI

NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more.

It is great for micro web apps, dashboards, robotics projects, smart home solutions and similar use cases. You can also use it in development, for example when tweaking/configuring a machine learning algorithm or tuning motor controllers.

NiceGUI is available as PyPI package, Docker image and on conda-forge as well as GitHub.

PyPI PyPI downloads Conda version Conda downloads Docker pulls
GitHub license GitHub commit activity GitHub issues GitHub forks GitHub stars DOI

Features

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: ui.notify('button was pressed'))

ui.run()

Launch it with:

python3 main.py

The GUI is now available through http://localhost:8080/ in your browser. Note: NiceGUI will automatically reload the page when you modify the code.

Documentation and Examples

The documentation is hosted at https://nicegui.io/documentation and provides plenty of live demos. The whole content of https://nicegui.io is implemented with NiceGUI itself and can be started locally with docker run -p 8080:8080 zauberzeug/nicegui or by executing main.py from this repository.

You may also have a look at our in-depth examples of what you can do with NiceGUI. In our wiki we have a list of great NiceGUI projects from the community, a section with Tutorials and a growing list of FAQs. When building NiceGUI projects with AI assistants, point them at nicegui/llms.md — a concise reference that ships with the package (also served at https://nicegui.io/llms.txt).

Why?

We at Zauberzeug like Streamlit but find it does too much magic when it comes to state handling. In search for an alternative nice library to write simple graphical user interfaces in Python we discovered JustPy. Although we liked the approach, it is too "low-level HTML" for our daily usage. But it inspired us to use Vue and Quasar for the frontend.

We have built on top of FastAPI, which itself is based on the ASGI framework Starlette and the ASGI webserver Uvicorn because of their great performance and ease of use.

Sponsors

Maintenance of this project is made possible by all the contributors and sponsors. If you would like to support this project and have your avatar or company logo appear below, please sponsor us. 💖

Lechler GmbH Zhifeng Wayne Houlden DigiQuip AS JACOB SHI TestMu AI Open Source Office (Formerly LambdaTest) Zaga Solutions DiscoLike Inc.

Consider this low-barrier form of contribution yourself. Your support is much appreciated.

Contributing

Thank you for your interest in contributing to NiceGUI! We are thrilled to have you on board and appreciate your efforts to make this project even better.

As a growing open-source project, we understand that it takes a community effort to achieve our goals. That's why we welcome all kinds of contributions, no matter how small or big they are. Whether it's adding new features, fixing bugs, improving documentation, or suggesting new ideas, we believe that every contribution counts and adds value to our project.

We have provided a detailed guide on how to contribute to NiceGUI in our CONTRIBUTING.md file. We encourage you to read it carefully before making any contributions to ensure that your work aligns with the project's goals and standards.

If you have any questions or need help with anything, please don't hesitate to reach out to us. We are always here to support and guide you through the contribution process.

Included Web Dependencies

See DEPENDENCIES.md for a list of web frameworks NiceGUI depends on.

Architecture

NiceGUI is a Python framework for building web UIs with a backend-first philosophy. Key architectural decisions:

nicegui (zauberzeug/nicegui)

Searching Database…

16.3K ·GitHub
这是什么?NiceGUI 是一个易于使用、基于 Python 的 UI 框架,界面显示在网页浏览器中,让你无需自己编写前端代码,就能构建按钮、对话框、3D 场景、图表、仪表板等。
使用它需要懂 HTML 或 JavaScript 吗?不需要。NiceGUI 以后端为核心:所有界面逻辑都写在 Python 代码中,框架负责处理网页相关的细节。其底层运行的是 Python/FastAPI 后端和 Vue/Quasar 前端,并通过 socket.io 进行同步。
如何让它运行起来?安装 PyPI 包,在 main.py 之类的文件中编写界面,然后用 ui.run() 启动;浏览器会自动打开,每次修改代码,页面都会自动重新加载。
除了 Python 本身,还需要安装什么?只需要 Python 本身。NiceGUI 以 PyPI 包、Docker 镜像和 conda-forge 的形式发布,你可以选择最适合自己工作流程的方式。
面对大流量时,它能否跨多个进程扩展?NiceGUI 有意只在单个 uvicorn 工作进程上运行,依赖完整的异步支持,而不是多进程同步。这是一个刻意的设计选择,而非缺陷,但在并发量非常高的部署场景中需要留意。
我能把应用做成桌面程序,而不是网站吗?可以。同一份代码既可以作为网页服务器通过浏览器访问,也可以以原生模式运行,像普通桌面窗口一样打开。
内置了哪些界面元素?包括标签、按钮、复选框、滑块和文件上传等标准元素,以及用于绘制图表、渲染 3D 场景、虚拟摇杆、图像标注、表格、可折叠树形结构,以及视频和音频嵌入等高级元素。
可以在 Jupyter Notebook 中使用吗?可以,NiceGUI 可以直接在 Jupyter Notebook 中运行,也支持 Python 交互模式。
数据变化时,界面会自动更新吗?会。它提供简洁的数据绑定和可刷新函数,让界面能自动更新,同时减少样板代码。
除了常见的网页应用,它还适合做什么?它主要面向微型网页应用、仪表板、机器人项目和智能家居方案,在开发过程中也很适合用来调试机器学习算法或调整电机控制器。
Creator
zauberzeug
Size
129.1 MB
Stars
16.3K
Age
5y
Commits · 90 Days