本文整理汇总了Python中kivy.event.EventDispatcher类的典型用法代码示例。如果您正苦于以下问题:Python EventDispatcher类的具体用法?Python EventDispatcher怎么用?Python EventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventDispatcher类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getattribute__
def __getattribute__(self, key):
# print ">> Trying to get %s" % key
if key in ("_model_attr", "__parent", "_model_class", "_model"):
return object.__getattribute__(self, key)
elif key in self._model_attr:
# print " INTERCEPTED!"
# Get the value of this key from the common data model
val = getattr(self.__parent, key)
# print " val or %s is %s" % (key, val)
# Typecase as needed
if isinstance(val, list):
# Construct a list of property objects
val2 = []
for a in val:
# We have to create a whole new UI model for these...
# class SubModel(UI_DataModel):
# _model_class = type(a)
# val2.append(SubModel(a))
val2.append(str(a))
else:
val2 = str(val)
# Invoke kivy's Property setter by setting our attribute
setattr(self, key, val2)
# Proceed as normal
return EventDispatcher.__getattribute__(self, key)
else:
# print " Pushing up to base class"
return EventDispatcher.__getattribute__(self, key)
示例2: __init__
def __init__(self, anim, widget):
EventDispatcher.__init__(self)
self.anim = anim
self.widget = widget
self.anim.bind(on_start=self._anim_started,
on_progress=self._anim_progress,
on_complete=self._anim_completed)
示例3: __new__
def __new__(cls, **kwargs):
if cls.__instance is None:
cls.__instance = EventDispatcher.__new__(cls)
return cls.__instance
示例4: __init__
def __init__(self, tile, maze, **kwargs):
MazeObject.__init__(self, tile=tile)#inherits from MazeObject
EventDispatcher.__init__(self, **kwargs)
self.orientation = 0 #0,1,2,3 = left,right,up,down
self.maze = maze