当前位置: 首页>>代码示例>>Python>>正文


Python properties.Clock类代码示例

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


在下文中一共展示了Clock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: callback1

 def callback1(self, dt):
     if dt >= 0.9:
         self.manager.get_screen('board1').popup.dismiss()
         self.manager.current = 'board2'
     else:
         self.manager.get_screen('board1').popup.open()
         Clock.schedule_once(self.callback1, 1)
开发者ID:Xayom,项目名称:Battleship_Kivy,代码行数:7,代码来源:main.py

示例2: on_enter

    def on_enter(self):
        global ENTRY_PLAYER

        if ENTRY_PLAYER == 0:
            MAIN_SOUND.stop()
            ENTRY_PLAYER = 1
            self.ids.grid.top = 760
            self.ids.grid.right = 1350

            for i in range(NUMBER_OF_BUTTONS):
                for j in range(NUMBER_OF_BUTTONS):
                    button = Button(text="")
                    button.size_hint = (100, 100)
                    button.coords = (i, j)
                    button.bind(on_press=self.button_pressed)
                    for ship in SHIPS_OF_PLAYER:
                        if ship[0] == (i, j):
                            button.background_color = ship[1]
                            button.name = str(ship[2])

                    self.ids.grid.add_widget(button)

            self.manager.current = 'board2'
            self.popup.open()
            Clock.schedule_once(self.callback, 1.5)
开发者ID:Xayom,项目名称:Battleship_Kivy,代码行数:25,代码来源:main.py

示例3: on_close_tab

    def on_close_tab(self, instance, *args):
        '''Event handler to close icon
        :param instance: tab instance
        '''
        d = get_designer()
        if d.popup:
            return False

        self.switch_to(instance)
        if instance.has_modification:
            # show a dialog to ask if can close
            confirm_dlg = ConfirmationDialog(
                    'All unsaved changes will be lost.\n'
                    'Do you want to continue?')
            popup = Popup(
                    title='New',
                    content=confirm_dlg,
                    size_hint=(None, None),
                    size=('200pt', '150pt'),
                    auto_dismiss=False)

            def close_tab(*args):
                d.close_popup()
                self._perform_close_tab(instance)

            confirm_dlg.bind(
                    on_ok=close_tab,
                    on_cancel=d.close_popup)
            popup.open()
            d.popup = popup
        else:
            Clock.schedule_once(partial(self._perform_close_tab, instance))
开发者ID:lstwzd,项目名称:kivy-designer,代码行数:32,代码来源:designer_content.py

示例4: on_text

    def on_text(self, *args):
        """updates the tab width when it has a new title
        """

        def update_width(*args):
            self.width = min(self.texture_size[0] + 40, 200)

        Clock.schedule_once(update_width)
开发者ID:Lh4cKg,项目名称:kivy-designer,代码行数:8,代码来源:designer_content.py

示例5: build

    def build(self):
        self.plot.points = [(point[0], point[1]) for point in
                            self.user.userECG.ecgListFFT]
        # self.plot.points = [(x, sin(x / 100.)) for x in range(self.counter,
        #                                                       self.counter + 10)]
        self.graph.add_plot(self.plot)

        Clock.schedule_interval(self.update, 1.0 / 60.0)

        return self.graph
开发者ID:neurotechuoft,项目名称:Wall-EEG,代码行数:10,代码来源:kivy_app.py

示例6: on_pre_enter

    def on_pre_enter(self):
        for child in self.ids.grid.children:
                child.background_color = [1, 1, 1, 1]

        def my_callback(dt):
            view.dismiss()

        view = ModalView(size=(100, 100))
        view.background = 'img.jpg'
        view.open()
        Clock.schedule_once(my_callback, 5)
开发者ID:Xayom,项目名称:Battleship_Kivy,代码行数:11,代码来源:Battleship.py

示例7: button_pressed

    def button_pressed(self, button):
        if button.text == 'YES':
            self.manager.current = 'main'
            self.popup.dismiss()
        else:
            global CURRENT_PLAYER, AMOUNT, CURRENT1, SOME_LIST1
            row, column = button.coords
            status_index = row * 10 + column
            already_played = self.status[status_index]
            if not already_played and CURRENT_PLAYER == 1:
                self.status[status_index] = CURRENT_PLAYER

                for ship in SHIPS_OF_COMP:
                    if ship[0] == (row, column):
                        CURRENT1 += 1
                        SOME_LIST1.append((row, column))
                        button.background_color = ship[1]
                        #button.text = str(ship[2])
                        self.sound.stop()
                        self.sound = SoundLoader.load('bomb2.wav')
                        self.sound.play()

                        if CURRENT1 == ship[2]:
                            for ship in SOME_LIST1:
                                x, y = ship
                                s = [1, 0, -1]
                                t = [1, 0, -1]
                                for xx in s:
                                    for yy in t:
                                        for child in self.ids.grid.children:
                                            if child.coords == (x + xx, y + yy) and (x + xx, y + yy) not in SOME_LIST1:
                                                child.text = 'X'
                                                child.background_color = [1, 0, 0, 1]
                            SOME_LIST1 = []
                            CURRENT1 = 0

                        AMOUNT += 1
                        if AMOUNT == 4 + 3 * 2 + 2 * 3 + 4:
                            Winner.play()
                            winner.children[0].text = 'You WIN!!!!!'
                            winner.bind(on_dismiss = self.somefunc)
                            winner.open()
                        break

                if button.background_color == [1, 1, 1, 1]:
                    button.text = 'X'

                    self.sound.stop()
                    self.sound = SoundLoader.load('Not_ship.wav')
                    self.sound.play()

                    button.background_color = [1, 0, 0, 1]
                    Clock.schedule_once(self.callback, 1)
                    CURRENT_PLAYER *= -1
开发者ID:Xayom,项目名称:Battleship_Kivy,代码行数:54,代码来源:Battleship.py

示例8: __init__

 def __init__(self, **kwargs):
     super(NewsWidget, self).__init__(**kwargs)
     self.app = App.get_running_app()
     app_config = self.app.config
     provider = app_config.get('news', 'provider')
     news_module = imp.load_source(provider, os.path.join(PROJECT_PATH, 'libs', "news", "%s.py" % provider))
     self.news_provider = news_module.News()
     Clock.schedule_interval(self.update_news, 600)
     Clock.schedule_interval(self.rotate_news, app_config.getint('news', 'cycle_interval'))
     self.update_news()
     self.key_handler = self.app.key_handler
     self.key_handler.bind('down', lambda *args: self.rotate_news(direction='next', manual=True))
     self.key_handler.bind('up', lambda *args: self.rotate_news(direction='prev', manual=True))
开发者ID:talpah,项目名称:pivystation,代码行数:13,代码来源:news.py

示例9: __init__

    def __init__(self, **kw):
        super().__init__(**kw)

        self.playlist = StaticPlaylist([

        ])
        self.__cached_playlist = list(self.playlist)
        self.load_audio()

        def update_position(_):
            if self.sound and self.sound.state == 'play':
                self.last_sound_position = self.sound.get_pos()

        Clock.schedule_interval(update_position, 1.5)
开发者ID:tomerghelber,项目名称:pyplayer,代码行数:14,代码来源:main_screen.py

示例10: on_start

 def on_start(self):
     ble_central.init()
     ble_peripheral.init()
     ble_central.set_callbacks(on_state=self.central_state_changed,
                               on_discover=self.discover)
     ble_peripheral.set_callbacks(on_state=self.peripheral_state_changed,
                                  on_service_added=self.peripheral_service_added,
                                  on_service_error=self.peripheral_service_error,
                                  on_advertising_started=self.peripheral_adv,
                                  on_advertising_error=self.peripheral_adv,
                                  on_characteristic_subscribed=self.char_sub,
                                  on_characteristic_write=self.char_write)
     self.scanning = ble_central.is_scanning
     Clock.schedule_interval(self.update_list, 0.5)
开发者ID:mritchie712,项目名称:ble_example,代码行数:14,代码来源:main.py

示例11: pull

        def pull(*args):
            '''Do a pull in a separated thread
            '''
            try:
                remote_repo.pull(progress=progress)

                def set_progress_done(*args):
                    progress.label.text = 'Completed!'

                Clock.schedule_once(set_progress_done, 1)
                progress.stop()
                show_message('Git remote pull completed!', 5)
            except GitCommandError as e:
                progress.label.text = 'Failed to pull!\n' + str(e)
            get_designer().close_popup()
开发者ID:Python-PyBD,项目名称:kivy-designer,代码行数:15,代码来源:designer_git.py

示例12: on_close_tab

 def on_close_tab(self, instance, *args):
     """Event handler to close icon
     :param instance: tab instance
     """
     self.switch_to(instance)
     if instance.has_modification:
         # show a dialog to ask if can close
         confirm_dlg = ConfirmationDialog("All unsaved changes will be lost.\n" "Do you want to continue?")
         self._popup = Popup(
             title="New", content=confirm_dlg, size_hint=(None, None), size=("200pt", "150pt"), auto_dismiss=False
         )
         confirm_dlg.bind(on_ok=partial(self._perform_close_tab, instance), on_cancel=self._popup.dismiss)
         self._popup.open()
     else:
         Clock.schedule_once(partial(self._perform_close_tab, instance))
开发者ID:Lh4cKg,项目名称:kivy-designer,代码行数:15,代码来源:designer_content.py

示例13: __init__

    def __init__(self, **kwargs):
        super(ZbarQrcodeDetector, self).__init__(**kwargs)
        # my code
        #
        self.add_widget(self.labell)


        def Course_thread(dt):
            self.labell.text = "24923849"
            self._examplefunc()
            print "r"
            #self.examplefunc("rrrr")

            #self._send_request_dzyk(
            #    'bal_sum/', params=None,
            #    success=self._get_commands_result_dzyk_balance_allsum, error=self._get_commands_error_dzyk)


        Clock.schedule_interval(Course_thread, 1)


        # ID of the command being executed
        self._cmd_id = None

        # List of the "completed" statuses.
        # The first status should be "Done"
        self._completed = []

        # If True - sends a request to retrieve a command status
        self._wait_completion = False

        # requested command
        self._command = (0, '')


        #----------------------------------
        self._camera = AndroidCamera(
                size=self.camera_size,
                size_hint=(None, None))
        self._camera.bind(on_preview_frame=self._detect_qrcode_frame)
        self.add_widget(self._camera)

        # create a scanner used for detecting qrcode
        self._scanner = ImageScanner()
        self._scanner.setConfig(0, Config.ENABLE, 0)
        self._scanner.setConfig(Symbol.QRCODE, Config.ENABLE, 1)
        self._scanner.setConfig(0, Config.X_DENSITY, 3)
        self._scanner.setConfig(0, Config.Y_DENSITY, 3)
开发者ID:dzyk,项目名称:android-zbar-qrcode,代码行数:48,代码来源:main.py

示例14: push

        def push(*args):
            '''Do a push in a separated thread
            '''
            try:
                remote_repo.push(self.repo.active_branch.name,
                                 progress=progress)

                def set_progress_done(*args):
                    progress.label.text = 'Completed!'

                Clock.schedule_once(set_progress_done, 1)
                progress.stop()
                show_message('Git remote push completed!', 5)
            except GitCommandError as e:
                progress.label.text = 'Failed to push!\n' + str(e)
            self._popup.dismiss()
开发者ID:AM7000000,项目名称:kivy-designer,代码行数:16,代码来源:designer_git.py

示例15: _send_command_result

 def _send_command_result(self, request, response):
     # Parses API-call response
     try:
         if response['status'] not in self._completed:
             # Executing in progress
             self._cmd_id = response['id']
             if self._wait_completion:
                 Clock.schedule_once(self._get_status, 1)
         else:
             # Command "completed"
             if response['status'] == self._completed[0]:
                 self.last_accepted_command = response['code_dsp']
             self._progress_complete(
                 'Command "%s" is %s' %
                 (response['code_dsp'], response['status_dsp']))
     except Exception as e:
         XError(text=str(e)[:256])
开发者ID:ophermit,项目名称:RemoteControlInterface,代码行数:17,代码来源:main.py


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