本文整理汇总了Python中thorpy.elements.clickable.Clickable.user_func方法的典型用法代码示例。如果您正苦于以下问题:Python Clickable.user_func方法的具体用法?Python Clickable.user_func怎么用?Python Clickable.user_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thorpy.elements.clickable.Clickable
的用法示例。
在下文中一共展示了Clickable.user_func方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_button
# 需要导入模块: from thorpy.elements.clickable import Clickable [as 别名]
# 或者: from thorpy.elements.clickable.Clickable import user_func [as 别名]
def make_button(text, func=None, params=None):
button = Clickable(text)
button.finish()
button.scale_to_title()
if func:
button.user_func = func
if params:
button.user_params = params
return button
示例2: _set_path_elements
# 需要导入模块: from thorpy.elements.clickable import Clickable [as 别名]
# 或者: from thorpy.elements.clickable.Clickable import user_func [as 别名]
def _set_path_elements(self, ycoord=None):
self.remove_all_elements()
i = 0
for s in self._path_list:
e = Clickable(s)
e.set_style("text")
e.normal_params.params["font_size"] = style.PATH_FONT_SIZE
e.press_params.params["font_size"] = style.PATH_FONT_SIZE
e.finish()
e.user_func = self._reaction_path
e.user_params = {"n" : i}
e.set_jailed(self.father)
## e._lock_jail = True #so that in the future jail will always stay self.father
self.add_elements([e])
i += 1
father = self
if self.father.is_finished():
father = self.father
fr = father.get_storer_rect()
wtot = h_store(fr, self._elements, gap=0, xstart="auto", ycoord=ycoord)
if wtot > fr.width:
h_store(fr, self._elements, gap=0, ycoord=ycoord,
xstart=fr.right - wtot-2)
self._n = len(self._elements)