本文整理汇总了Python中vispy.util.event.EmitterGroup.auto_connect_format方法的典型用法代码示例。如果您正苦于以下问题:Python EmitterGroup.auto_connect_format方法的具体用法?Python EmitterGroup.auto_connect_format怎么用?Python EmitterGroup.auto_connect_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vispy.util.event.EmitterGroup
的用法示例。
在下文中一共展示了EmitterGroup.auto_connect_format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_group_autoconnect
# 需要导入模块: from vispy.util.event import EmitterGroup [as 别名]
# 或者: from vispy.util.event.EmitterGroup import auto_connect_format [as 别名]
def test_group_autoconnect(self):
"""EmitterGroup auto-connect"""
class Source:
def on_em1(self, ev):
self.result = 1
def em2_event(self, ev):
self.result = 2
def em3_event(self, ev):
self.result = 3
src = Source()
grp = EmitterGroup(source=src, em1=Event, auto_connect=False)
src.result = None
grp.em1()
assert src.result is None
grp = EmitterGroup(source=src, em1=Event, auto_connect=True)
src.result = None
grp.em1()
assert src.result == 1
grp.auto_connect_format = "%s_event"
grp.add(em2=Event)
src.result = None
grp.em2()
assert src.result == 2
grp.add(em3=Event, auto_connect=False)
src.result = None
grp.em3()
assert src.result is None