本文整理汇总了Python中kivy.uix.checkbox.CheckBox.height方法的典型用法代码示例。如果您正苦于以下问题:Python CheckBox.height方法的具体用法?Python CheckBox.height怎么用?Python CheckBox.height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.checkbox.CheckBox
的用法示例。
在下文中一共展示了CheckBox.height方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import height [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
示例2: __init__
# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import height [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
示例3: __init__
# 需要导入模块: from kivy.uix.checkbox import CheckBox [as 别名]
# 或者: from kivy.uix.checkbox.CheckBox import height [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