How to use the kivy.clock.Clock function in Kivy

To help you get started, we’ve selected a few Kivy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HeaTTheatR / KivyMD / demos / kitchen_sink / demo_apps / fitnessclub.py View on Github external
def set_item_menu(self):
        def anim_item(*args):
            instance_item = args[0]
            Animation(
                x=(App.get_running_app().Window.width // 2) - dp(30),
                d=0.15,
                t="in_out_bounce",
            ).start(instance_item)

        Clock.schedule_once(lambda x: anim_item(self.ids.exercises), 0.1)
        Clock.schedule_once(lambda x: anim_item(self.ids.nutrition), 0.15)
        Clock.schedule_once(lambda x: anim_item(self.ids.motivation), 0.2)
        Clock.schedule_once(lambda x: anim_item(self.ids.about), 0.25)
github Abraxos / hermes / hermes-native / test_find_index_of_selected_conversation.py View on Github external
def run_test(self, app, *args):
        Clock.schedule_interval(self.pause, 0.000001)

        # Setup
        app.main_window.finish_init(None)
        app.main_window.add_conversation_to_UI()

        # Execute
        app.main_window.find_index_of_selected_conversation('conversation_0')

        # Assert
        self.assertEqual(app.main_window.current_screen_index, 2)

        # Comment out if you are editing the test, it'll leave the
        # Window opened.
        app.stop()
github johnyburd / glucometer / classes / FlappyBird.py View on Github external
def on_touch_down(self, touch):
        self.jumping = True
        self.bird_image.source = "res/images/flappynormal.png"
        self.velocity_y = self.jump_height / (self.jump_time * 60.0)
        Clock.unschedule(self.stop_jumping)
        Clock.schedule_once(self.switch_to_normal, self.jump_time  / 5.0)
github Kovak / FlatKivy / flat_kivy / flatapp.py View on Github external
def raise_error(self, error_title, error_text, auto_dismiss=True, timeout=None):
        error_content = ErrorContent()
        error_popup = FlatPopup(
            content=error_content, size_hint=(.6, .4),
            auto_dismiss=auto_dismiss)
        error_content.error_text = error_text
        error_popup.title = error_title
        dismiss_button = error_content.dismiss_button
        dismiss_button.bind(on_release=error_popup.dismiss)
        error_popup.open()
        if timeout is not None:
            def close_popup(dt):
                error_popup.dismiss()
            Clock.schedule_once(close_popup, timeout)
github BillBillBillBill / Tickeys-linux / tickeys / kivy / support.py View on Github external
else:
                # app resuming now !
                Logger.info('Android: Android has resumed, resume the app.')
                app.dispatch('on_resume')
                Window.canvas.ask_update()
                g_android_redraw_count = 25  # 5 frames/seconds for 5 seconds
                Clock.unschedule(_android_ask_redraw)
                Clock.schedule_interval(_android_ask_redraw, 1 / 5)
                Logger.info('Android: App resume completed.')

        # app doesn't support pause mode, just stop it.
        else:
            Logger.info('Android: App doesn\'t support pause mode, stop.')
            stopTouchApp()

    Clock.schedule_interval(android_check_pause, 0)
github kivy / kivent / old_tutorials / 6_adding_a_pause_button / main.py View on Github external
def init_game(self, dt):
        self.setup_states()
        self.set_state()
        self.setup_map()
        self.setup_collision_callbacks()
        self.load_stars()
        self.load_asteroids()
        Clock.schedule_interval(self.update, 0)
github kivy / kivy / kivy / tools / benchmark.py View on Github external
def run(self):
        o = []
        for x in self.labels:
            o.append(Button(text=x))
        # tick for texture creation
        Clock.tick()
github undercase / FlappyKivy / FlappyBird.py View on Github external
def build(self):
        game = FlappyBirdGame()
        Clock.schedule_interval(game.update, 1.0/60.0)
        return game
github AndreMiras / PyWallet / src / pywallet / overview.py View on Github external
def __init__(self, **kwargs):
        super(Overview, self).__init__(**kwargs)
        Clock.schedule_once(lambda dt: self.setup())