本文整理汇总了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)
示例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)
示例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.)
示例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)
示例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')
示例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)
示例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
示例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)
示例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)
示例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)
示例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
示例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)
示例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.)
示例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)
示例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)