Files
2024-09-19 07:18:27 +02:00
..
2024-09-19 07:18:27 +02:00

Rio Logo

Rio 是创建网页以及Apps且容易使用的框架 且完成建立于Python上. 🐍
不需要任何HTML, CSS或JavaScript 去创建精美的Apps

Tutorial - Examples - Discord - Docs - Source Code

Rio将React-style components带进Python。取得丰富的内建元件并组合他们以创建自己客制化的元件。之后将组合元件带入Apps中。更强大的是Rio可以在本地以及网页上运行。

Rio Version Python Version License GitHub Stars Downloads

Image Generation Example

Features 🧩

  • 现代, 宣告式 UI 框架
  • 100% Python - 不需要 HTML, CSS, or JavaScript
  • 超过 50种内建元件 提供常用UI元素, 比如 rio.Switch, rio.Button, 和 rio.Text, 以及更多
  • 结合 现代Python工具: 由于 entirely Type Safe 编辑器给予立即反馈及立即指出错误
  • Apps可以运行在 本地与网页上
  • 包含开发工具
  • 开源 & 永久免费

Example ⌨️

# Define a component that counts button clicks
class ButtonClicker(rio.Component):
    # Define the attributes of the component. Rio will watch these
    # for changes and automatically update the GUI.
    clicks: int = 0

    # Define a method that increments the click count. We'll later
    # make a button that calls this method whenever it is pressed.
    def _on_press(self) -> None:
        self.clicks += 1

    # Define the `build` method. This method essentially tells rio
    # what a ButtonClicker component looks like. Whenever the state
    # of the ButtonClicker component changes, rio will call its
    # `build` method and update the GUI according to the output.
    def build(self) -> rio.Component:
        return rio.Column(
            rio.Button('Click me', on_press=self._on_press),
            rio.Text(f'You clicked the button {self.clicks} time(s)'),
        )

# Create an App and tell it to display a ButtonClicker when it starts
app = rio.App(build=ButtonClicker)
app.run_in_browser()  # Or `app.run_in_window()` to run as local app!

安装 🛠️

Rio可在PyPI取得, 所以可以使用pip安装:

pip install rio-ui

开始 🎓

Rio有着非常强大的指令帮助您。使用简短指令创建新专案:

rio new

您可以选择多种内建模板帮助您开始。以下是简单的tic-tac-toe范例专案:

rio new my-project --type website --template "Tic-Tac-Toe"
cd my-project
rio run

你将会得到第一个app且只花费您几秒钟!

状态: 开发中 🚧

Rio持续更新中。我们致力于提供您最好的使用经验。如果您有任何建议请在Discord与我们联系 our Discord server.

贡献 🤝

任何专案成长于社群的帮助, 在Rio更是如此. 依然有许多地方可以精进, 像是增加新feature, 解决bugs, 或是分享您的想法。 请先阅读我们的 贡献指引 当您新增Pull Request到专案中。 当每周更新featureRio持续完善。 点星 以及 👀 关注 这个 repo 以获取最新消息!

任何Rio贡献应建立于Apache-2.0证书上,没有额外的规定或情况。

社群支持 🫶

加入Rio并成为我们的一分子以下是如何联系我们:

  • Discord (Level up your Rio skills! 加入Discord服务器 to chat with other developers and discuss how to contribute.)
  • GitHub (发现bug? Issues are the perfect place to let us know. Feeling super-helpful? Try fixing an existing issue and submit a PR!)
  • Community Forum (加入Github社群论坛 for asking questions and discussions)
  • Feature Requests (Cleanest way to 请求一个feature on GitHub)

使用Rio, 请标示引用来源为official Rio documentation.