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

Method _drawturtle

Lib/turtle.py:3112–3148  ·  view source on GitHub ↗

Manages the correct rendering of the turtle with respect to its shape, resizemode, stretch and tilt etc.

(self)

Source from the content-addressed store, hash-verified

3110 return tuple((t11*x + t12*y, t21*x + t22*y) for (x, y) in polygon)
3111
3112 def _drawturtle(self):
3113 """Manages the correct rendering of the turtle with respect to
3114 its shape, resizemode, stretch and tilt etc."""
3115 screen = self.screen
3116 shape = screen._shapes[self.turtle.shapeIndex]
3117 ttype = shape._type
3118 titem = self.turtle._item
3119 if self._shown and screen._updatecounter == 0 and screen._tracing > 0:
3120 self._hidden_from_screen = False
3121 tshape = shape._data
3122 if ttype == "polygon":
3123 if self._resizemode == "noresize": w = 1
3124 elif self._resizemode == "auto": w = self._pensize
3125 else: w =self._outlinewidth
3126 shape = self._polytrafo(self._getshapepoly(tshape))
3127 fc, oc = self._fillcolor, self._pencolor
3128 screen._drawpoly(titem, shape, fill=fc, outline=oc,
3129 width=w, top=True)
3130 elif ttype == "image":
3131 screen._drawimage(titem, self._position, tshape)
3132 elif ttype == "compound":
3133 for item, (poly, fc, oc) in zip(titem, tshape):
3134 poly = self._polytrafo(self._getshapepoly(poly, True))
3135 screen._drawpoly(item, poly, fill=self._cc(fc),
3136 outline=self._cc(oc), width=self._outlinewidth, top=True)
3137 else:
3138 if self._hidden_from_screen:
3139 return
3140 if ttype == "polygon":
3141 screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), "", "")
3142 elif ttype == "image":
3143 screen._drawimage(titem, self._position,
3144 screen._shapes["blank"]._data)
3145 elif ttype == "compound":
3146 for item in titem:
3147 screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), "", "")
3148 self._hidden_from_screen = True
3149
3150############################## stamp stuff ###############################
3151

Callers 3

resetMethod · 0.95
_updateMethod · 0.95
updateMethod · 0.80

Calls 5

_polytrafoMethod · 0.95
_getshapepolyMethod · 0.95
_ccMethod · 0.95
_drawpolyMethod · 0.80
_drawimageMethod · 0.80

Tested by

no test coverage detected