當前位置: 首頁>>代碼示例>>Python>>正文


Python Clock.schedule_interval方法代碼示例

本文整理匯總了Python中kivy.clock.Clock.schedule_interval方法的典型用法代碼示例。如果您正苦於以下問題:Python Clock.schedule_interval方法的具體用法?Python Clock.schedule_interval怎麽用?Python Clock.schedule_interval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.clock.Clock的用法示例。


在下文中一共展示了Clock.schedule_interval方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def __init__(self, **kwargs):
        global cap, frame, frame_size

        # capture and render the first frame
        self.frame_size = frame_size
        frame = cap.read()
        image = cv2.flip(frame, 0)
        image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
        image = cv2.resize(image, frame_size)
        buf = image.tostring()
        self.image_texture = Texture.create(size=(image.shape[1], image.shape[0]), colorfmt='rgb')
        self.image_texture.blit_buffer(buf, colorfmt='rgb', bufferfmt='ubyte')

        # coordinates of Trashy
        self.t_x = 0
        self.t_y = 0

        self.current_user = 'No user yet'
        self.tickcount = 0
        self.labels = ["can", "bottle", "ken",
                       "grace", "frank", "tim", "shelly"]
        self.users = ["ken", "grace", "frank", "tim", "shelly"]

        super(MainView, self).__init__(**kwargs)
        Clock.schedule_interval(self.tick, 0.06) 
開發者ID:tlkh,項目名稱:SmartBin,代碼行數:27,代碼來源:SmartBinApp.py

示例2: on_enter

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def on_enter(self):

        if not self.running:

            # The screen hasn't been run before so let's tell the user
            # that we need to get the photos
            self.loading = PhotoLoading(name="loading")
            self.photoscreen.add_widget(self.loading)
            self.photoscreen.current = "loading"

            # Retrieve photos
            Clock.schedule_once(self.getPhotos, 0.5)

        else:
            # We've been here before so just show the photos
            self.timer = Clock.schedule_interval(self.showPhoto,
                                                 self.photoduration) 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:19,代碼來源:screen.py

示例3: start

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def start(win, ctx):
    # late import to avoid breaking module loading
    from kivy.input.postproc import kivy_postproc_modules
    kivy_postproc_modules['fps'] = StatsInput()
    global _ctx
    ctx.label = Label(text='FPS: 0.0')
    ctx.inputstats = 0
    ctx.stats = []
    ctx.statsr = []
    with win.canvas.after:
        ctx.color = Color(1, 0, 0, .5)
        ctx.rectangle = Rectangle(pos=(0, win.height - 25),
                                  size=(win.width, 25))
        ctx.color = Color(1, 1, 1)
        ctx.rectangle = Rectangle(pos=(5, win.height - 20))
        ctx.color = Color(1, 1, 1, .5)
        for x in range(64):
            ctx.stats.append(0)
            ctx.statsr.append(
                Rectangle(pos=(win.width - 64 * 4 + x * 4, win.height - 25),
                          size=(4, 0)))
    Clock.schedule_interval(partial(update_fps, ctx), .5)
    Clock.schedule_interval(partial(update_stats, ctx), 1 / 60.) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:25,代碼來源:monitor.py

示例4: _update_files

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def _update_files(self, *args, **kwargs):
        # trigger to start gathering the files in the new directory
        # we'll start a timer that will do the job, 10 times per frames
        # (default)
        self._gitems = []
        self._gitems_parent = kwargs.get('parent', None)
        self._gitems_gen = self._generate_file_entries(
            path=kwargs.get('path', self.path),
            parent=self._gitems_parent)

        # cancel any previous clock if exist
        Clock.unschedule(self._create_files_entries)

        # show the progression screen
        self._hide_progress()
        if self._create_files_entries():
            # not enough for creating all the entries, all a clock to continue
            # start a timer for the next 100 ms
            Clock.schedule_interval(self._create_files_entries, .1) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:21,代碼來源:filechooser.py

示例5: __init__

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def __init__(self, **kwargs):
        self._context = Context(init=True)
        self._context['ExceptionManager'] = SandboxExceptionManager(self)
        self._context.sandbox = self
        self._context.push()
        self.on_context_created()
        self._container = None
        super(Sandbox, self).__init__(**kwargs)
        self._container = SandboxContent(size=self.size, pos=self.pos)
        super(Sandbox, self).add_widget(self._container)
        self._context.pop()

        # force SandboxClock's scheduling
        Clock.schedule_interval(self._clock_sandbox, 0)
        Clock.schedule_once(self._clock_sandbox_draw, -1)
        self.main_clock = object.__getattribute__(Clock, '_obj') 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:18,代碼來源:sandbox.py

示例6: _on_textinput_focused

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def _on_textinput_focused(self, instance, value, *largs):
        self.focus = value

        win = EventLoop.window
        self.cancel_selection()
        self._hide_cut_copy_paste(win)

        if value:
            if (not (self.readonly or self.disabled) or _is_desktop and
                self._keyboard_mode == 'system'):
                Clock.schedule_interval(self._do_blink_cursor, 1 / 2.)
                self._editable = True
            else:
                self._editable = False
        else:
            Clock.unschedule(self._do_blink_cursor)
            self._hide_handles(win) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:19,代碼來源:textinput.py

示例7: build

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def build(self):
    self.handlingKey = False
    self.manager = ScanRoot()

    # Set up GPIO pin for foot pedal
    os.system("gpio export 21 up")
    wiringpi.wiringPiSetupSys()
    #wiringpi.pinMode(21, 0)
    #wiringpi.pullUpDnControl(21, 2)
    self.lastPedal = 0

    Clock.schedule_interval(self.update, 0.5)
    Clock.schedule_interval(self.checkPedal, 0.05)

    Window.bind(on_key_down=self.on_key_down)
    Window.bind(on_key_up=self.on_key_up)
    return self.manager 
開發者ID:Tenrec-Builders,項目名稱:pi-scan,代碼行數:19,代碼來源:main.py

示例8: _timer_start

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def _timer_start(self):
        # Need to stop it, otherwise we potentially leak a timer id that will
        # never be stopped.
        self._timer_stop()
        self._timer = Clock.schedule_interval(self._on_timer, self._interval / 1000.0) 
開發者ID:kivy-garden,項目名稱:garden.matplotlib,代碼行數:7,代碼來源:backend_kivy.py

示例9: __init__

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def __init__(self, capture, fps, **kwargs):
        super(KivyCamera, self).__init__(**kwargs)
        self.capture = capture
        Clock.schedule_interval(self.update, 1.0 / fps) 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:6,代碼來源:kivy_cv1.py

示例10: monitor

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def monitor(self, iteration=10):
        self.iterations = iteration
        self.score = 0
        self.event = Clock.schedule_interval(self.set_label, 1) 
開發者ID:littlejo,項目名稱:huawei-lte-examples,代碼行數:6,代碼來源:main.py

示例11: build

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def build(self):
            """called from Kivy. Build and return the root widget for
            our application and schedule updates every second"""
            main=KomodoroMain()
            Clock.schedule_interval(main.update, 1.0)
            return main 
開發者ID:yaptb,項目名稱:BlogCode,代碼行數:8,代碼來源:komodoro.py

示例12: __init__

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def __init__(self, **kwargs):
        from kivy.base import EventLoop
        EventLoop.ensure_window()
        self._invalid_scale = True
        self._tiles = []
        self._tiles_bg = []
        self._tilemap = {}
        self._layers = []
        self._default_marker_layer = None
        self._need_redraw_all = False
        self._transform_lock = False
        self.trigger_update(True)
        self.canvas = Canvas()
        self._scatter = MapViewScatter()
        self.add_widget(self._scatter)
        with self._scatter.canvas:
            self.canvas_map = Canvas()
            self.canvas_layers = Canvas()
        with self.canvas:
            self.canvas_layers_out = Canvas()
        self._scale_target_anim = False
        self._scale_target = 1.
        self._touch_count = 0
        self.map_source.cache_dir = self.cache_dir
        Clock.schedule_interval(self._animate_color, 1 / 60.)
        self.lat = kwargs.get("lat", self.lat)
        self.lon = kwargs.get("lon", self.lon)
        super(MapView, self).__init__(**kwargs) 
開發者ID:pythonindia,項目名稱:PyCon-Mobile-App,代碼行數:30,代碼來源:view.py

示例13: animated_diff_scale_at

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def animated_diff_scale_at(self, d, x, y):
        self._scale_target_time = 1.
        self._scale_target_pos = x, y
        if self._scale_target_anim == False:
            self._scale_target_anim = True
            self._scale_target = d
        else:
            self._scale_target += d
        Clock.unschedule(self._animate_scale)
        Clock.schedule_interval(self._animate_scale, 1 / 60.) 
開發者ID:pythonindia,項目名稱:PyCon-Mobile-App,代碼行數:12,代碼來源:view.py

示例14: __init__

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def __init__(self, max_workers=None, cap_time=None, **kwargs):
        self.cache_dir = kwargs.get('cache_dir', CACHE_DIR)
        if max_workers is None:
            max_workers = Downloader.MAX_WORKERS
        if cap_time is None:
            cap_time = Downloader.CAP_TIME
        super(Downloader, self).__init__()
        self.is_paused = False
        self.cap_time = cap_time
        self.executor = ThreadPoolExecutor(max_workers=max_workers)
        self._futures = []
        Clock.schedule_interval(self._check_executor, 1 / 60.)
        if not exists(self.cache_dir):
            makedirs(self.cache_dir) 
開發者ID:pythonindia,項目名稱:PyCon-Mobile-App,代碼行數:16,代碼來源:downloader.py

示例15: connect

# 需要導入模塊: from kivy.clock import Clock [as 別名]
# 或者: from kivy.clock.Clock import schedule_interval [as 別名]
def connect(self):
        self.host = self.root.ids.server.text
        self.nick = self.root.ids.nickname.text

        self.is_stop = False
        self.loop = asyncio.get_event_loop()

        if self.reconnect():

            self.clock_receive = Clock.schedule_interval(self.receive_msg, 1)
            self.clock_detect = Clock.schedule_interval(self.detect_if_offline, 3)

            self.root.current = 'chatroom'
            self.save_config()
            print('-- connecting to ' + self.host) 
開發者ID:yingshaoxo,項目名稱:kivy-chat,代碼行數:17,代碼來源:asyncio_main.py


注:本文中的kivy.clock.Clock.schedule_interval方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。