本文整理汇总了Python中pyglet.event.EventDispatcher类的典型用法代码示例。如果您正苦于以下问题:Python EventDispatcher类的具体用法?Python EventDispatcher怎么用?Python EventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventDispatcher类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, x=0, y=0, z=0, width=100, height=100,
anchor_x='left', anchor_y='bottom', *args, **kwargs):
''' Create a displayable widget.
:Parameters:
`x` : float
X coordinate of the widget relative to anchor_x.
`y` : float
Y coordinate of the widget relative to anchor_y.
`z` : float
Z coordinate of the widget plane.
`width` : int
Width of the widget.
`height` : int
Height of the widget.
`anchor_x` : str
Horizontal alignment of the widget.
See `Widget.anchor_x` for details.
`anchor_y` : str
Vertical alignment of the widget.
See `Widget.anchor_y` for details.
'''
EventDispatcher.__init__(self)
self._x, self._y, self._z = x, y, z
self._root_x, self._root_y, self._root_z = 0,0,0
self._width = width
self._height = height
self.anchor_x = anchor_x
self.anchor_y = anchor_y
self._children = []
self._elements = {}
self._moveable = True
self._focusable = True
self._sizeable = True
self._hidden = False
开发者ID:Sankluj,项目名称:PyWidget,代码行数:35,代码来源:widget.py
示例2: dispatch_events
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,代码行数:25,代码来源:__init__.py
示例3: __init__
def __init__(self):
EventDispatcher.__init__(self)
assert isinstance(self._event_stack, tuple)
self._event_stack = [self.default_event_handlers]
# list of elements that have responded to an on_element_enter event
self.entered_elements = list()
开发者ID:bitcraft,项目名称:pyglet,代码行数:7,代码来源:event.py
示例4: __init__
def __init__(self, client):
EventDispatcher.__init__(self)
self.client = client
# We need to keep track of which block we are pressing (if any). This
# way we can have it so you have to press on and let up on a block
# before it registers. (which is important as that's how people's
# software works and how they expect the game to work)
self.pressed_block = None
开发者ID:msarch,项目名称:py,代码行数:9,代码来源:lesson1.py
示例5: dispatch_pending_events
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,代码行数:9,代码来源:__init__.py
示例6: __init__
def __init__(self, image=None):
if image is None:
image = ResourceManager.get_player_image()
ShootingSprite.__init__(self, image, rotation=90, bound_to_window=True)
EventDispatcher.__init__(self)
self.health = 100
self.max_health = 100
self.armor = None
self.missle_damage = 10
self.hit_damage = 100
self.score = 0
self.detonate = True
开发者ID:Krzycho,项目名称:python-shooter,代码行数:14,代码来源:player.py
示例7: __init__
def __init__(self):
Layer.__init__(self)
EventDispatcher.__init__(self)
self.waves = []
self.current_wave = None
self.wave_delay = 3
self.countdown_label = None
self.countdown_texts = []
self.is_started = False
self.is_next_wave_notified = False
self.is_enemies_deployed = False
self.next_level_notified = False
self.bonuses = []
开发者ID:Krzycho,项目名称:python-shooter,代码行数:14,代码来源:enemy_layer.py
示例8: dispatch_events
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,代码行数:16,代码来源:__init__.py
示例9: dispatch_pending_events
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,代码行数:11,代码来源:__init__.py
示例10: dispatch_events
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,代码行数:37,代码来源:__init__.py
示例11: dispatch_pending_events
def dispatch_pending_events(self):
while self._event_queue:
event = self._event_queue.pop(0)
EventDispatcher.dispatch_event(self, *event)
开发者ID:dpkay,项目名称:gfxnuggets,代码行数:4,代码来源:__init__.py
示例12: dispatch_pending_events
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,代码行数:6,代码来源:__init__.py
示例13: __init__
def __init__(self, **kwargs):
Widget.__init__(self, **kwargs)
EventDispatcher.__init__(self)
if not self.bounds:
self.bounds = "always"
self.is_focused = True
开发者ID:msarch,项目名称:py,代码行数:6,代码来源:main.py
示例14: __init__
def __init__( self, client ):
EventDispatcher.__init__(self)
self.client = client
self.setStart = False
self.setEnd = False
self.erase = False
开发者ID:brandonl,项目名称:a-maze,代码行数:6,代码来源:astar.py
示例15: __init__
def __init__(self, x=0, y=0):
EventDispatcher.__init__(self)
self.pos = Vec(x, y)
开发者ID:naymen,项目名称:MELA,代码行数:3,代码来源:base.py
示例16: __init__
def __init__(self, master):
EventDispatcher.__init__(self)
self.master = master
self.owner = master
开发者ID:Ecialo,项目名称:Codename-Parzalon,代码行数:4,代码来源:actor.py
注:本文中的pyglet.event.EventDispatcher类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论