MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _drawturtle

Method _drawturtle

tools/python-3.11.9-amd64/Lib/turtle.py:3011–3047  ·  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

3009 return tuple((t11*x + t12*y, t21*x + t22*y) for (x, y) in polygon)
3010
3011 def _drawturtle(self):
3012 """Manages the correct rendering of the turtle with respect to
3013 its shape, resizemode, stretch and tilt etc."""
3014 screen = self.screen
3015 shape = screen._shapes[self.turtle.shapeIndex]
3016 ttype = shape._type
3017 titem = self.turtle._item
3018 if self._shown and screen._updatecounter == 0 and screen._tracing > 0:
3019 self._hidden_from_screen = False
3020 tshape = shape._data
3021 if ttype == "polygon":
3022 if self._resizemode == "noresize": w = 1
3023 elif self._resizemode == "auto": w = self._pensize
3024 else: w =self._outlinewidth
3025 shape = self._polytrafo(self._getshapepoly(tshape))
3026 fc, oc = self._fillcolor, self._pencolor
3027 screen._drawpoly(titem, shape, fill=fc, outline=oc,
3028 width=w, top=True)
3029 elif ttype == "image":
3030 screen._drawimage(titem, self._position, tshape)
3031 elif ttype == "compound":
3032 for item, (poly, fc, oc) in zip(titem, tshape):
3033 poly = self._polytrafo(self._getshapepoly(poly, True))
3034 screen._drawpoly(item, poly, fill=self._cc(fc),
3035 outline=self._cc(oc), width=self._outlinewidth, top=True)
3036 else:
3037 if self._hidden_from_screen:
3038 return
3039 if ttype == "polygon":
3040 screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), "", "")
3041 elif ttype == "image":
3042 screen._drawimage(titem, self._position,
3043 screen._shapes["blank"]._data)
3044 elif ttype == "compound":
3045 for item in titem:
3046 screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), "", "")
3047 self._hidden_from_screen = True
3048
3049############################## stamp stuff ###############################
3050

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