MCPcopy Index your code
hub / github.com/python/cpython / ontimer

Method ontimer

Lib/turtle.py:1468–1487  ·  view source on GitHub ↗

Install a timer, which calls fun after t milliseconds. Arguments: fun -- a function with no arguments. t -- a number >= 0 Example (for a TurtleScreen instance named screen): >>> running = True >>> def f(): ... if running: ...

(self, fun, t=0)

Source from the content-addressed store, hash-verified

1466 self._listen()
1467
1468 def ontimer(self, fun, t=0):
1469 """Install a timer, which calls fun after t milliseconds.
1470
1471 Arguments:
1472 fun -- a function with no arguments.
1473 t -- a number >= 0
1474
1475 Example (for a TurtleScreen instance named screen):
1476
1477 >>> running = True
1478 >>> def f():
1479 ... if running:
1480 ... fd(50)
1481 ... lt(60)
1482 ... screen.ontimer(f, 250)
1483 ...
1484 >>> f() # makes the turtle marching around
1485 >>> running = False
1486 """
1487 self._ontimer(fun, t)
1488
1489 def bgpic(self, picname=None):
1490 """Set background image or return name of current backgroundimage.

Callers

nothing calls this directly

Calls 1

_ontimerMethod · 0.80

Tested by

no test coverage detected