本文整理汇总了Python中pyglet.clock.unschedule函数的典型用法代码示例。如果您正苦于以下问题:Python unschedule函数的具体用法?Python unschedule怎么用?Python unschedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unschedule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
def start(self):
if self.__running:
unschedule(self.update)
self.__running = False
else:
schedule_interval(self.update, self.speed)
self.__running = True
示例2: visible
def visible(self, visible):
self._visible = visible
clock.unschedule(self._blink)
if visible and self._active and self.PERIOD:
clock.schedule_interval(self._blink, self.PERIOD)
self._blink_visible = False # flipped immediately by next blink
self._blink(0)
示例3: pause
def pause(self):
if not self.playing: return
clock.unschedule(self.update)
self.player.pause()
self.control.play.setVisible(True)
self.control.pause.setVisible(False)
self.playing = False
示例4: game_exit_callback
def game_exit_callback(self, *args):
if self._overlay:
unschedule(self._overlay.update)
self._overlay = None
self.win.pop_handlers()
self.win.close()
示例5: leave
def leave(self):
# get the end time
self.end_time = now()
# update the parent state time to actual elapsed time if necessary
if self.duration < 0:
if isinstance(self, ParentState):
# advance the duration the children moved the this parent
duration = self.state_time-self.start_time
else:
# advance the duration of this state
duration = self.end_time-self.start_time
self.advance_parent_state_time(duration)
# remove the callback from the schedule
clock.unschedule(self.callback)
# notify the parent that we're done
self.active = False
self.done = True
if self.parent:
self.parent.check = True
# call custom leave code
self._leave()
# write log to the state log
#print self.get_log()
if self.save_log:
dump([self.get_log()],self.get_log_stream())
pass
示例6: stopRepeat
def stopRepeat(self):
if self.delay_timer is not None:
self.delay_timer.cancel()
self.delay_timer = None
if self.repeating:
clock.unschedule(self.repeat)
self.repeating = False
示例7: village_scene
def village_scene(dt):
clock.unschedule(spawn_troll)
s.Narration("This time")
s.Narration("They will say")
s.Title("You are the Villain")
clock.schedule_interval(village_callback, 5)
for i in range(counter + 4):
s.Villager(on_death = decrement_counter)
示例8: on_rerun_menu
def on_rerun_menu():
unschedule(func=self.update)
#reset current handler
self.win.pop_handlers()
#and setup update handler
self.win.push_handlers(self.menu)
self.menu.start_bgrn_animation()
示例9: _update_schedule
def _update_schedule(self):
clock.unschedule(self.dispatch_events)
if self._playing and self._sources:
interval = 1000.0
if self._sources[0].video_format:
interval = min(interval, 1 / 24.0)
if self._audio:
interval = min(interval, self._audio.UPDATE_PERIOD)
clock.schedule_interval_soft(self.dispatch_events, interval)
示例10: in_transition
def in_transition(self):
for index, transition in enumerate(self.queue):
if transition["phase"] == 0:
del self.queue[index]
if len(self.queue) <= 0:
clock.unschedule(self.tick)
return len(self.queue) > 0
示例11: scene2
def scene2(dt):
print "scene2"
s.Narration('Why me?')
s.Narration('Alone')
s.Narration('Why me?')
s.Narration('Alone')
s.Narration('This is not fair')
clock.unschedule(spawn_troll)
clock.schedule_interval(spawn_troll, 3)
clock.schedule_once(scene3, 20)
示例12: delete
def delete(self):
"""Force immediate removal of the sprite from video memory.
This is often necessary when using batches, as the Python garbage
collector will not necessarily call the finalizer as soon as the
sprite is garbage.
"""
if self._animation:
clock.unschedule(self._animate)
self._vertex_list.delete()
self._vertex_list = None
示例13: test_unschedule
def test_unschedule(self):
clock.set_default(clock.Clock())
clock.schedule(self.callback)
result = clock.tick()
self.assertTrue(result == self.callback_dt)
self.callback_dt = None
time.sleep(1)
clock.unschedule(self.callback)
result = clock.tick()
self.assertTrue(self.callback_dt == None)
示例14: test_schedule_multiple
def test_schedule_multiple(self):
clock.set_default(clock.Clock())
clock.schedule(self.callback)
clock.schedule(self.callback)
self.callback_count = 0
clock.tick()
self.assertTrue(self.callback_count == 2)
clock.unschedule(self.callback)
clock.tick()
self.assertTrue(self.callback_count == 2)
示例15: update
def update(self, dt):
self._total_time += dt
alpha = self._total_time / float(self._duration)
self._label.begin_update()
self._label.x = alpha * (self._x1 - self._x0) + self._x0
self._label.y = alpha * (self._y1 - self._y0) + self._y0
self._label.font_size = alpha * (self._end_font_size - self._init_font_size) + self._init_font_size
self._label.end_update()
if self._total_time > self._duration:
self.window.remove_handlers(self)
clock.unschedule(self.update)