本文整理汇总了Python中timer.Timer.finish方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.finish方法的具体用法?Python Timer.finish怎么用?Python Timer.finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer.Timer
的用法示例。
在下文中一共展示了Timer.finish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_timer
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import finish [as 别名]
def test_timer(self):
t = Timer()
id = t.start();
id1 = t.start();
print("wheeeeee")
t.end(id, "mooo")
t.end(id1, "fooo")
t.finish()
示例2: PopupHinter
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import finish [as 别名]
class PopupHinter(Label):
SHOW_TIME = 6.
SHOWWING = 1
SHOWN = 2
HIDING = 3
HIDED = 0
AllArgs = update_join(Label.AllArgs,
bgcolor="(0xf5, 0xf1, 0x28, 0xff)",
)
def init(self):
self._curPosY = None
self._timer = None
self.state = self.HIDED
self.hide()
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()
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
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