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)
| 1337 | self._listen() |
| 1338 | |
| 1339 | def ontimer(self, fun, t=0): |
| 1340 | """Install a timer, which calls fun after t milliseconds. |
| 1341 | |
| 1342 | Arguments: |
| 1343 | fun -- a function with no arguments. |
| 1344 | t -- a number >= 0 |
| 1345 | |
| 1346 | Example (for a TurtleScreen instance named screen): |
| 1347 | |
| 1348 | >>> running = True |
| 1349 | >>> def f(): |
| 1350 | ... if running: |
| 1351 | ... fd(50) |
| 1352 | ... lt(60) |
| 1353 | ... screen.ontimer(f, 250) |
| 1354 | ... |
| 1355 | >>> f() # makes the turtle marching around |
| 1356 | >>> running = False |
| 1357 | """ |
| 1358 | self._ontimer(fun, t) |
| 1359 | |
| 1360 | def bgpic(self, picname=None): |
| 1361 | """Set background image or return name of current backgroundimage. |