MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / bgpic

Method bgpic

Python/Turtle.py:1360–1382  ·  view source on GitHub ↗

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

(self, picname=None)

Source from the content-addressed store, hash-verified

1358 self._ontimer(fun, t)
1359
1360 def bgpic(self, picname=None):
1361 """Set background image or return name of current backgroundimage.
1362
1363 Optional argument:
1364 picname -- a string, name of a gif-file or "nopic".
1365
1366 If picname is a filename, set the corresponding image as background.
1367 If picname is "nopic", delete backgroundimage, if present.
1368 If picname is None, return the filename of the current backgroundimage.
1369
1370 Example (for a TurtleScreen instance named screen):
1371 >>> screen.bgpic()
1372 'nopic'
1373 >>> screen.bgpic("landscape.gif")
1374 >>> screen.bgpic()
1375 'landscape.gif'
1376 """
1377 if picname is None:
1378 return self._bgpicname
1379 if picname not in self._bgpics:
1380 self._bgpics[picname] = self._image(picname)
1381 self._setbgpic(self._bgpic, self._bgpics[picname])
1382 self._bgpicname = picname
1383
1384 def screensize(self, canvwidth=None, canvheight=None, bg=None):
1385 """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