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


Python CheckBox.value方法代码示例

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


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

示例1: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import value [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

示例2: __init__

# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import value [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 value [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.value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。