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)
| 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. |