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

Method _drawturtle

Python/Turtle.py:2893–2929  ·  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

2891 return tuple((t11*x + t12*y, t21*x + t22*y) for (x, y) in polygon)
2892
2893 def _drawturtle(self):
2894 """Manages the correct rendering of the turtle with respect to
2895 its shape, resizemode, stretch and tilt etc."""
2896 screen = self.screen
2897 shape = screen._shapes[self.turtle.shapeIndex]
2898 ttype = shape._type
2899 titem = self.turtle._item
2900 if self._shown and screen._updatecounter == 0 and screen._tracing > 0:
2901 self._hidden_from_screen = False
2902 tshape = shape._data
2903 if ttype == "polygon":
2904 if self._resizemode == "noresize": w = 1
2905 elif self._resizemode == "auto": w = self._pensize
2906 else: w =self._outlinewidth
2907 shape = self._polytrafo(self._getshapepoly(tshape))
2908 fc, oc = self._fillcolor, self._pencolor
2909 screen._drawpoly(titem, shape, fill=fc, outline=oc,
2910 width=w, top=True)
2911 elif ttype == "image":
2912 screen._drawimage(titem, self._position, tshape)
2913 elif ttype == "compound":
2914 for item, (poly, fc, oc) in zip(titem, tshape):
2915 poly = self._polytrafo(self._getshapepoly(poly, True))
2916 screen._drawpoly(item, poly, fill=self._cc(fc),
2917 outline=self._cc(oc), width=self._outlinewidth, top=True)
2918 else:
2919 if self._hidden_from_screen:
2920 return
2921 if ttype == "polygon":
2922 screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), "", "")
2923 elif ttype == "image":
2924 screen._drawimage(titem, self._position,
2925 screen._shapes["blank"]._data)
2926 elif ttype == "compound":
2927 for item in titem:
2928 screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), "", "")
2929 self._hidden_from_screen = True
2930
2931############################## stamp stuff ###############################
2932

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