• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python clock.unschedule函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyglet.clock.unschedule函数的典型用法代码示例。如果您正苦于以下问题:Python unschedule函数的具体用法?Python unschedule怎么用?Python unschedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unschedule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:eordano,项目名称:random,代码行数:7,代码来源:conway.py


示例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)
开发者ID:bitcraft,项目名称:pyglet,代码行数:7,代码来源:caret.py


示例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
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:7,代码来源:movie.py


示例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()
开发者ID:varnie,项目名称:snake,代码行数:7,代码来源:Game.py


示例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
开发者ID:psederberg,项目名称:smile,代码行数:31,代码来源:state.py


示例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
开发者ID:bitcraft,项目名称:pyglet,代码行数:7,代码来源:slider.py


示例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)
开发者ID:dragonfi,项目名称:ld25-you-are-the-hero,代码行数:8,代码来源:script.py


示例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()
开发者ID:varnie,项目名称:snake,代码行数:8,代码来源:Game.py


示例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)
开发者ID:tyler-elric,项目名称:pypk,代码行数:9,代码来源:__init__.py


示例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
开发者ID:Bogdanp,项目名称:ymage,代码行数:9,代码来源:transition.py


示例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)
开发者ID:dragonfi,项目名称:ld25-you-are-the-hero,代码行数:10,代码来源:script.py


示例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
开发者ID:katalist5296,项目名称:irobotgame,代码行数:11,代码来源:sprite.py


示例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)
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:12,代码来源:SCHEDULE.py


示例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)
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:12,代码来源:SCHEDULE.py


示例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)
开发者ID:kearnh,项目名称:pqrs,代码行数:13,代码来源:objects.py


示例16: _set_image

    def _set_image(self, img):
        if self._animation is not None:
            clock.unschedule(self._animate)
            self._animation = None

        if isinstance(img, image.Animation):
            self._animation = img
            self._frame_index = 0
            self._set_texture(img.frames[0].image.get_texture())
            self._next_dt = img.frames[0].duration
            clock.schedule_once(self._animate, self._next_dt)
        else:
            self._set_texture(img.get_texture())
        self._update_position()
开发者ID:tyler-elric,项目名称:pypk,代码行数:14,代码来源:sprite.py


示例17: 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
        self._texture = None

        # Easy way to break circular reference, speeds up GC
        self._group = None
开发者ID:ajhager,项目名称:copycat,代码行数:15,代码来源:sprite.py


示例18: callborg

    def callborg(dt):
        global ANS, NBSEC
        if ANS:
            c = ANS.pop()
            console.write(c)
            console._caret.position = len(console._document.text)

        elif ANS==[]:
            console.write (' ',attributes={'color': (255, 255, 255, 255)})
            console.write ('\n')
            console.prompt()
            #console._document.delete_text(0, len(console._document.text)-1)
            #console._prompt_end = 0
            ANS = None
            clock.unschedule(callborg)
        else: ANS=None
开发者ID:vrx,项目名称:idia,代码行数:16,代码来源:borg_terminal_pyglet.py


示例19: run_snake

    def run_snake(self, *args):
        if self._overlay:
            unschedule(self._overlay.update)
            self._overlay = None

        #reset current handlers
        self.win.pop_handlers()

        self.gameInfo.pause = False
        self.gameField.reset()

        #setup new handlers
        self.win.push_handlers(self.gameField)

        #and setup update handler
        self._update_interval = Game.INITIAL_UPDATE_INTERVAL
        schedule_interval(func=self.update,interval=self._update_interval)
开发者ID:varnie,项目名称:snake,代码行数:17,代码来源:Game.py


示例20: play

def play(level):
    view = FlatView.from_window(w, layers=[level, effectlayer, rocketlayer])

    # set rocket start
    for col in level.cells:
        for cell in col:
            if 'player-start' in cell.properties:
                rocket.midtop = cell.midtop

    clock.schedule(rocket.update)
    rocket.properties.update(dict(dx=0, dy=0, done=0))

    # run game
    while not (w.has_exit or rocket.properties['done']):
        dt = clock.tick()
        w.dispatch_events()
        view.fx, view.fy = rocket.center
        view.clear((.2, .2, .2, .2))
        view.draw()
        fps.draw()
        w.flip()

    # put up a message
    done = rocket.properties['done']
    if not done:
        return
    if done == 1:
        text = 'YAY YOU LANDED!'
    if done == 2:
        text = 'BOO YOU CRASHED!'
    text += '  (press [escape] to continue)'
    sprite = TextSprite(font, text, color=(1., 1., 1., 1.))
    sprite.x, sprite.y = w.width / 2 - sprite.width / \
        2, w.height / 2 - sprite.height / 2
    w.has_exit = False
    while not w.has_exit:
        dt = clock.tick()
        w.dispatch_events()
        view.clear((.2, .2, .2, .2))
        view.draw()
        sprite.draw()
        w.flip()

    clock.unschedule(rocket.update)
    if boom in effectlayer.sprites:
        effectlayer.sprites.remove(boom)
开发者ID:bitcraft,项目名称:pyglet,代码行数:46,代码来源:lander.py



注:本文中的pyglet.clock.unschedule函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compat.asbytes函数代码示例发布时间:2022-05-25
下一篇:
Python clock.tick函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap