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

Method bgpic

Lib/turtle.py:1489–1511  ·  view source on GitHub ↗

Set background image or return name of current backgroundimage. Optional argument: picname -- a string, name of an image file (PNG, GIF, PGM, and PPM) or "nopic". If picname is a filename, set the corresponding image as background. If picname is "nopic", delete back

(self, picname=None)

Source from the content-addressed store, hash-verified

1487 self._ontimer(fun, t)
1488
1489 def bgpic(self, picname=None):
1490 """Set background image or return name of current backgroundimage.
1491
1492 Optional argument:
1493 picname -- a string, name of an image file (PNG, GIF, PGM, and PPM) or "nopic".
1494
1495 If picname is a filename, set the corresponding image as background.
1496 If picname is "nopic", delete backgroundimage, if present.
1497 If picname is None, return the filename of the current backgroundimage.
1498
1499 Example (for a TurtleScreen instance named screen):
1500 >>> screen.bgpic()
1501 'nopic'
1502 >>> screen.bgpic("landscape.gif")
1503 >>> screen.bgpic()
1504 'landscape.gif'
1505 """
1506 if picname is None:
1507 return self._bgpicname
1508 if picname not in self._bgpics:
1509 self._bgpics[picname] = self._image(picname)
1510 self._setbgpic(self._bgpic, self._bgpics[picname])
1511 self._bgpicname = picname
1512
1513 def screensize(self, canvwidth=None, canvheight=None, bg=None):
1514 """Resize the canvas the turtles are drawing on.

Callers

nothing calls this directly

Calls 2

_imageMethod · 0.80
_setbgpicMethod · 0.80

Tested by

no test coverage detected