3、remi--CheckBox

段愿仁长九 / 2024-02-23 / 原文

源码链接:remi.gui.CheckBox

  后面不不再在文中复述本地安装包的源码,本地源码请自行查看,文中只提供上述链接

 

复选框小部件:

  官网文档说的是:

  复选框小部件作为数值输入字段很有用,实现了onchange事件

 

小部件使用测试:

  

checkboxLab.py

import remi.gui as gui
from remi import start, App


class MyApp(App):
    def __init__(self, *args):
        super(MyApp, self).__init__(*args)

    def main(self):
        # 创建一个主容器(VBox)
        self.container = gui.VBox(width='100%', height='100%', style={'margin': 'auto', 'padding': '10px'})

        self.cb = gui.CheckBox(userdata='1', text='CheckBox',style={}) # style可自定义:**keywords

        self.container.append(self.cb)
        return self.container


if __name__ == "__main__":
    start(MyApp, debug=True, address='127.0.0.1', port=8085, start_browser=False, username=None, password=None)

 

checkbox的方法或属性:

  根据源码:

    其属性和方法在其类初始化时就已经完成了注册部件和调用方法的过程,所以使用的时候直接调用该类注册小部件即可