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)
| 1439 | self._listen() |
| 1440 | |
| 1441 | def ontimer(self, fun, t=0): |
| 1442 | """Install a timer, which calls fun after t milliseconds. |
| 1443 | |
| 1444 | Arguments: |
| 1445 | fun -- a function with no arguments. |
| 1446 | t -- a number >= 0 |
| 1447 | |
| 1448 | Example (for a TurtleScreen instance named screen): |
| 1449 | |
| 1450 | >>> running = True |
| 1451 | >>> def f(): |
| 1452 | ... if running: |
| 1453 | ... fd(50) |
| 1454 | ... lt(60) |
| 1455 | ... screen.ontimer(f, 250) |
| 1456 | ... |
| 1457 | >>> f() # makes the turtle marching around |
| 1458 | >>> running = False |
| 1459 | """ |
| 1460 | self._ontimer(fun, t) |
| 1461 | |
| 1462 | def bgpic(self, picname=None): |
| 1463 | """Set background image or return name of current backgroundimage. |