本文整理汇总了Python中timer.Timer.add方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.add方法的具体用法?Python Timer.add怎么用?Python Timer.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer.Timer
的用法示例。
在下文中一共展示了Timer.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hide_hint
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def hide_hint(self):
root = Root.instance
self._curPosY = ValueAnimate(
self.pos[1], root.size[1])
if self._timer:
self._timer.finish()
self._timer = Timer(0.1, self._animate)
Timer.add(self._timer)
self.state = self.HIDING
示例2: input
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def input(self, e):
if e.key == K_RETURN:
self.on_mouse_down()
if self.is_under_mouse(mouse.pos):
Timer.add(Timer(0.2, self.on_mouse_up, 1))
else:
Timer.add(Timer(0.2, self.on_mouse_out, 1))
self.command(e)
else:
return True
示例3: show_hint
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def show_hint(self, hint):
root = Root.instance
self.text = hint
tsize = self.Font.size(hint)
self.resize((tsize[0]+6, tsize[1]+4))
self._curPosY = ValueAnimate(
self.pos[1], root.size[1] - self.size[1])
if self._timer:
self._timer.finish()
self._timer = Timer(1./FPS, self._animate)
Timer.add(self._timer)
self.show()
self.state = self.SHOWWING
示例4: init
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def init(self):
# Focusable.__init__(self)
self.label = Label(self, text=self.caption, align=self.align, color=self.color, bgcolor=COLOR_TRANS, size=self.size)
self._underMouse = False
self._commands = []
self.bind(EV_MOUSEOVER, self.on_mouse_over, BLK_PRE_NONBLOCK)
self.bind(EV_MOUSEDOWN, self.on_mouse_down, BLK_PRE_NONBLOCK)
self.bind(EV_MOUSEOUT, self.on_mouse_out, BLK_PRE_NONBLOCK)
self.bind(EV_MOUSEUP, self.on_mouse_up, BLK_PRE_NONBLOCK)
self.curColor = ColorAnimate((0, 0, 0, 0xff), self.bgcolor)
Timer.add(Timer(1./FPS, self.animate))
self.bind(EV_CLICK, self.command, BLK_PRE_BLOCK)
self.bind_command(self.on_mouse_out)
示例5: _animate
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def _animate(self, dt):
self.pos = self.pos[0], self._curPosY.get()
if self._curPosY.is_end():
if self.state == self.HIDING:
self.state == self.HIDED
if self._timer:
self._timer.finish()
self._timer = None
self.hide()
elif self.state == self.SHOWWING:
self.state = self.SHOWN
tm = Timer(self.SHOW_TIME, self.hide_hint, 1)
Timer.add(tm)
if self._timer: self._timer.finish()
self._timer = tm
return
self.mark_redraw()
示例6: init
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def init(self):
Focusable.__init__(self)
self.minWidth = self.size[0]
self.minHeight = self.size[1]
self.bgLabel = Label(self, level=10, size=self.size, text='', bgcolor=self.bgcolor)
self.hoverButton = TransButton(self, level=11, size=self.size)
self.txtLabel = Label(self, level=12, size=self.size,
color=self.color, text=self.text, bgcolor=COLOR_TRANS)
self.redraw()
self.bind(EV_CLICK, self.set_as_focus, BLK_PRE_BLOCK)
self._editing = False
Timer.add(Timer(1./FPS, self.animate))
self.blinker = ColorAnimate(self.bgcolor, self.bgcolor)
self.confirmCallBacks = []
self.changeCallBacks = []
self._confirmed = False
示例7: __init__
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def __init__(self, parent, **dargs):
super(PopupMenu, self).__init__(parent, **dargs)
Timer.add(Timer(1./FPS, self.animate))
self.bind_key(K_ESCAPE, self.hide)
示例8: __init__
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import add [as 别名]
def __init__(self, v1, v2):
self.v = v1
self.v1 = v2
self._end = False
self.timer = Timer.add(Timer(1.0 / FPS, self.step, 1000))