当前位置: 首页>>代码示例>>Python>>正文


Python CheckBox.active方法代码示例

本文整理汇总了Python中kivy.uix.checkbox.CheckBox.active方法的典型用法代码示例。如果您正苦于以下问题:Python CheckBox.active方法的具体用法?Python CheckBox.active怎么用?Python CheckBox.active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.uix.checkbox.CheckBox的用法示例。


在下文中一共展示了CheckBox.active方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_tb_lr_stacklayout

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
    def test_tb_lr_stacklayout(self):
        from kivy.uix.checkbox import CheckBox
        a = CheckBox(allow_no_selection=False, group='check')
        b = CheckBox(allow_no_selection=False, group='check')

        a.active = True
        self.assertTrue(a.active)
        self.assertEqual(a.state, 'down')

        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.active = True
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        a.state = 'down'
        self.assertTrue(a.active)
        self.assertEqual(a.state, 'down')

        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.state = 'down'
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        b.state = 'normal'
        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')
        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')

        b.state = 'down'
        self.assertTrue(b.active)
        self.assertEqual(b.state, 'down')

        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')

        b.active = False
        self.assertFalse(a.active)
        self.assertEqual(a.state, 'normal')
        self.assertFalse(b.active)
        self.assertEqual(b.state, 'normal')
开发者ID:matham,项目名称:kivy,代码行数:53,代码来源:test_6315.py

示例2: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
 def __init__(self, title, choices, key, callback, keep_choice_order=False):
     Factory.Popup.__init__(self)
     print(choices, type(choices))
     if keep_choice_order:
         orig_index = {choice: i for (i, choice) in enumerate(choices)}
         sort_key = lambda x: orig_index[x[0]]
     else:
         sort_key = lambda x: x
     if type(choices) is list:
         choices = dict(map(lambda x: (x,x), choices))
     layout = self.ids.choices
     layout.bind(minimum_height=layout.setter('height'))
     for k, v in sorted(choices.items(), key=sort_key):
         l = Label(text=v)
         l.height = '48dp'
         l.size_hint_x = 4
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         cb.size_hint_x = 1
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         layout.add_widget(l)
         layout.add_widget(cb)
     layout.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
开发者ID:ahmedbodi,项目名称:electrum,代码行数:33,代码来源:choice_dialog.py

示例3: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
 def __init__(self, title, choices, key, callback):
     Factory.Popup.__init__(self)
     if type(choices) is list:
         choices = dict(map(lambda x: (x,x), choices))
     layout = self.ids.choices
     layout.bind(minimum_height=layout.setter('height'))
     for k, v in sorted(choices.items()):
         l = Label(text=v)
         l.height = '48dp'
         l.size_hint_x = 4
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         cb.size_hint_x = 1
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         layout.add_widget(l)
         layout.add_widget(cb)
     layout.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
开发者ID:btchip,项目名称:electrum,代码行数:27,代码来源:choice_dialog.py

示例4: show_plugins

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
 def show_plugins(self, plugins_list):
     def on_checkbox_active(cb, value):
         self.plugins.toggle_enabled(self.electrum_config, cb.name)
     for item in self.plugins.descriptions:
         if 'kivy' not in item.get('available_for', []):
             continue
         name = item.get('name')
         label = Label(text=item.get('fullname'))
         plugins_list.add_widget(label)
         cb = CheckBox()
         cb.name = name
         p = self.plugins.get(name)
         cb.active = (p is not None) and p.is_enabled()
         cb.bind(active=on_checkbox_active)
         plugins_list.add_widget(cb)
开发者ID:Gamecredits-Universe,项目名称:Gamecredits-electrum-client,代码行数:17,代码来源:main_window.py

示例5: getCellChk

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
 def getCellChk(self,fila,columna,Activo,Disabled = False,Size=200,Tipo="chk"):
     """Funcion que devuelve una celda completa para manejo de checkbox"""
     cell = GridRow()
     cell.id = "row{0}_col{1}".format(fila,columna)
     cell.size = [Size,40]
     cchk=CheckBox()
     cchk.id=Tipo
     cchk.active=Activo
     cchk.disabled=Disabled
     cchk.background_checkbox_disabled_down='atlas://data/images/defaulttheme/checkbox_on'
     cchk.text_size=cell.size
     if Tipo == "borrar":
         cchk.bind(active=self.borradoCkick)
     cell.add_widget(cchk)
     return cell
开发者ID:jlermauip,项目名称:uip-prog3,代码行数:17,代码来源:Parcial1.py

示例6: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
    def __init__(self, settings, dashboard_factory, **kwargs):
        super(DashboardScreenPreferences, self).__init__(**kwargs)
        self._settings = settings

        current_screens = self._settings.userPrefs.get_dashboard_screens()
        screen_keys = dashboard_factory.available_dashboards
        for key in screen_keys:
            [name, image] = dashboard_factory.get_dashboard_preview_image_path(key)
            checkbox = CheckBox()
            checkbox.active = True if key in current_screens else False
            checkbox.bind(active=lambda i, v, k=key:self._screen_selected(k, v))
            screen_item = DashboardScreenItem()
            screen_item.add_widget(checkbox)
            screen_item.add_widget(FieldLabel(text=name))
            screen_item.add_widget(Image(source=image))
            self.ids.grid.add_widget(screen_item)
        self._current_screens = current_screens
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:19,代码来源:dashboardview.py

示例7: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import active [as 别名]
 def __init__(self, title, choices, key, callback):
     Factory.Popup.__init__(self)
     for k, v in choices.items():
         l = Label(text=v)
         l.height = '48dp'
         cb = CheckBox(group='choices')
         cb.value = k
         cb.height = '48dp'
         def f(cb, x):
             if x: self.value = cb.value
         cb.bind(active=f)
         if k == key:
             cb.active = True
         self.ids.choices.add_widget(l)
         self.ids.choices.add_widget(cb)
     self.ids.choices.add_widget(Widget(size_hint_y=1))
     self.callback = callback
     self.title = title
     self.value = key
开发者ID:Emzy,项目名称:electrum,代码行数:21,代码来源:choice_dialog.py


注:本文中的kivy.uix.checkbox.CheckBox.active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。