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

Method __init__

Lib/turtle.py:955–993  ·  view source on GitHub ↗
(self, cv, mode=_CFG["mode"],
                 colormode=_CFG["colormode"], delay=_CFG["delay"])

Source from the content-addressed store, hash-verified

953 _RUNNING = True
954
955 def __init__(self, cv, mode=_CFG["mode"],
956 colormode=_CFG["colormode"], delay=_CFG["delay"]):
957 TurtleScreenBase.__init__(self, cv)
958
959 self._shapes = {
960 "arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))),
961 "turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7),
962 (-7,9), (-9,8), (-6,5), (-7,1), (-5,-3), (-8,-6),
963 (-6,-8), (-4,-5), (0,-7), (4,-5), (6,-8), (8,-6),
964 (5,-3), (7,1), (6,5), (9,8), (7,9), (4,7), (1,10),
965 (2,14))),
966 "circle" : Shape("polygon", ((10,0), (9.51,3.09), (8.09,5.88),
967 (5.88,8.09), (3.09,9.51), (0,10), (-3.09,9.51),
968 (-5.88,8.09), (-8.09,5.88), (-9.51,3.09), (-10,0),
969 (-9.51,-3.09), (-8.09,-5.88), (-5.88,-8.09),
970 (-3.09,-9.51), (-0.00,-10.00), (3.09,-9.51),
971 (5.88,-8.09), (8.09,-5.88), (9.51,-3.09))),
972 "square" : Shape("polygon", ((10,-10), (10,10), (-10,10),
973 (-10,-10))),
974 "triangle" : Shape("polygon", ((10,-5.77), (0,11.55),
975 (-10,-5.77))),
976 "classic": Shape("polygon", ((0,0),(-5,-9),(0,-7),(5,-9))),
977 "blank" : Shape("image", self._blankimage())
978 }
979
980 self._bgpics = {"nopic" : ""}
981
982 self._mode = mode
983 self._delayvalue = delay
984 self._colormode = _CFG["colormode"]
985 self._keys = []
986 self.clear()
987 if sys.platform == 'darwin':
988 # Force Turtle window to the front on OS X. This is needed because
989 # the Turtle window will show behind the Terminal window when you
990 # start the demo from the command line.
991 rootwindow = cv.winfo_toplevel()
992 rootwindow.call('wm', 'attributes', '.', '-topmost', '1')
993 rootwindow.call('wm', 'attributes', '.', '-topmost', '0')
994
995 def clear(self):
996 """Delete all drawings and all turtles from the TurtleScreen.

Callers

nothing calls this directly

Calls 6

clearMethod · 0.95
ShapeClass · 0.85
_blankimageMethod · 0.80
winfo_toplevelMethod · 0.80
__init__Method · 0.45
callMethod · 0.45

Tested by

no test coverage detected