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


Python EventDispatcher.dispatch_event方法代碼示例

本文整理匯總了Python中pyglet.event.EventDispatcher.dispatch_event方法的典型用法代碼示例。如果您正苦於以下問題:Python EventDispatcher.dispatch_event方法的具體用法?Python EventDispatcher.dispatch_event怎麽用?Python EventDispatcher.dispatch_event使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyglet.event.EventDispatcher的用法示例。


在下文中一共展示了EventDispatcher.dispatch_event方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dispatch_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
    def dispatch_events(self):
        self._allow_dispatch_event = True
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        e = EventRef()
        result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))
        while result == noErr:
            carbon.SendEventToEventTarget(e, self._event_dispatcher)
            carbon.ReleaseEvent(e)

            if self._recreate_deferred:
                self._recreate_immediate()
            result = carbon.ReceiveNextEvent(0, c_void_p(), 0, True, byref(e))

        self._allow_dispatch_event = False

        # Return value from ReceiveNextEvent can be ignored if not
        # noErr; we check here only to look for new bugs.
        # eventLoopQuitErr: the inner event loop was quit, see
        # http://lists.apple.com/archives/Carbon-dev/2006/Jun/msg00850.html
        # Can occur when mixing with other toolkits, e.g. Tk.
        # Fixes issue 180.
        if result not in (eventLoopTimedOutErr, eventLoopQuitErr):
            raise 'Error %d' % result
開發者ID:tyler-elric,項目名稱:pypk,代碼行數:27,代碼來源:__init__.py

示例2: dispatch_pending_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         if type(event[0]) is str:
             # pyglet event
             EventDispatcher.dispatch_event(self, *event)
         else:
             # win32 event
             event[0](*event[1:])
開發者ID:Benrflanders,項目名稱:Pytris,代碼行數:11,代碼來源:__init__.py

示例3: dispatch_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
    def dispatch_events(self):
        self._allow_dispatch_event = True
        while self._event_queue:
            event = self._event_queue.pop(0)
            if type(event[0]) is str:
                # pyglet event
                EventDispatcher.dispatch_event(self, *event)
            else:
                # win32 event
                event[0](*event[1:])

        msg = MSG()
        while _user32.PeekMessageW(byref(msg), self._hwnd, 0, 0, PM_REMOVE):
            _user32.TranslateMessage(byref(msg))
            _user32.DispatchMessageW(byref(msg))
        self._allow_dispatch_event = False
開發者ID:certik,項目名稱:sympy-oldcore,代碼行數:18,代碼來源:__init__.py

示例4: dispatch_pending_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
    def dispatch_pending_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        # Dispatch any context-related events
        if self._lost_context:
            self._lost_context = False
            EventDispatcher.dispatch_event(self, 'on_context_lost')
        if self._lost_context_state:
            self._lost_context_state = False
            EventDispatcher.dispatch_event(self, 'on_context_state_lost')
開發者ID:AJCraddock,項目名稱:-ducking-octo-shame,代碼行數:13,代碼來源:__init__.py

示例5: dispatch_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
    def dispatch_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        # Dispatch any context-related events
        if self._lost_context:
            self._lost_context = False
            EventDispatcher.dispatch_event(self, 'on_context_lost')
        if self._lost_context_state:
            self._lost_context_state = False
            EventDispatcher.dispatch_event(self, 'on_context_state_lost')

        self._allow_dispatch_event = True

        e = xlib.XEvent()

        # Cache these in case window is closed from an event handler
        _x_display = self._x_display
        _window = self._window

        # Check for the events specific to this window
        while xlib.XCheckWindowEvent(_x_display, _window,
                0x1ffffff, byref(e)):
            if xlib.XFilterEvent(e, 0):
                continue
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)

        # Generic events for this window (the window close event).
        while xlib.XCheckTypedWindowEvent(_x_display, _window, 
                xlib.ClientMessage, byref(e)):
            event_handler = self._event_handlers.get(e.type)
            if event_handler:
                event_handler(e)
        
        self._allow_dispatch_event = False
開發者ID:KevinGoodsell,項目名稱:sympy,代碼行數:39,代碼來源:__init__.py

示例6: dispatch_pending_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
 def dispatch_pending_events(self):
     while self._event_queue:
         event = self._event_queue.pop(0)
         EventDispatcher.dispatch_event(self, *event)
開發者ID:dpkay,項目名稱:gfxnuggets,代碼行數:6,代碼來源:__init__.py

示例7: dispatch_pending_events

# 需要導入模塊: from pyglet.event import EventDispatcher [as 別名]
# 或者: from pyglet.event.EventDispatcher import dispatch_event [as 別名]
    def dispatch_pending_events(self):
        while self._event_queue:
            EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))

        if self._recreate_deferred:
            self._recreate_immediate()
開發者ID:tyler-elric,項目名稱:pypk,代碼行數:8,代碼來源:__init__.py


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