Set background image or return name of current backgroundimage. Optional argument: picname -- a string, name of a gif-file or "nopic". If picname is a filename, set the corresponding image as background. If picname is "nopic", delete backgroundimage, if presen
(self, picname=None)
| 1460 | self._ontimer(fun, t) |
| 1461 | |
| 1462 | def bgpic(self, picname=None): |
| 1463 | """Set background image or return name of current backgroundimage. |
| 1464 | |
| 1465 | Optional argument: |
| 1466 | picname -- a string, name of a gif-file or "nopic". |
| 1467 | |
| 1468 | If picname is a filename, set the corresponding image as background. |
| 1469 | If picname is "nopic", delete backgroundimage, if present. |
| 1470 | If picname is None, return the filename of the current backgroundimage. |
| 1471 | |
| 1472 | Example (for a TurtleScreen instance named screen): |
| 1473 | >>> screen.bgpic() |
| 1474 | 'nopic' |
| 1475 | >>> screen.bgpic("landscape.gif") |
| 1476 | >>> screen.bgpic() |
| 1477 | 'landscape.gif' |
| 1478 | """ |
| 1479 | if picname is None: |
| 1480 | return self._bgpicname |
| 1481 | if picname not in self._bgpics: |
| 1482 | self._bgpics[picname] = self._image(picname) |
| 1483 | self._setbgpic(self._bgpic, self._bgpics[picname]) |
| 1484 | self._bgpicname = picname |
| 1485 | |
| 1486 | def screensize(self, canvwidth=None, canvheight=None, bg=None): |
| 1487 | """Resize the canvas the turtles are drawing on. |