當前位置: 首頁>>代碼示例>>Python>>正文


Python event.EventDispatcher類代碼示例

本文整理匯總了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)
開發者ID:jsexauer,項目名稱:ItBuildsCharacter,代碼行數:28,代碼來源:data_model_wrapper.py

示例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)
開發者ID:2xR,項目名稱:legacy,代碼行數:7,代碼來源:animation.py

示例3: __new__

 def __new__(cls, **kwargs):
     if cls.__instance is None:
         cls.__instance = EventDispatcher.__new__(cls)
     return cls.__instance
開發者ID:derekstavis,項目名稱:kivy,代碼行數:4,代碼來源:__init__.py

示例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
開發者ID:akdor1154,項目名稱:fit3140,代碼行數:5,代碼來源:simulation.py


注:本文中的kivy.event.EventDispatcher類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。