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

Method clearstamps

tools/python-3.11.9-amd64/Lib/turtle.py:3133–3159  ·  view source on GitHub ↗

Delete all or first/last n of turtle's stamps. Optional argument: n -- an integer If n is None, delete all of pen's stamps, else if n > 0 delete first n stamps else if n < 0 delete last n stamps. Example (for a Turtle instance named turtle)

(self, n=None)

Source from the content-addressed store, hash-verified

3131 self._update()
3132
3133 def clearstamps(self, n=None):
3134 """Delete all or first/last n of turtle&#x27;s stamps.
3135
3136 Optional argument:
3137 n -- an integer
3138
3139 If n is None, delete all of pen&#x27;s stamps,
3140 else if n > 0 delete first n stamps
3141 else if n < 0 delete last n stamps.
3142
3143 Example (for a Turtle instance named turtle):
3144 >>> for i in range(8):
3145 ... turtle.stamp(); turtle.fd(30)
3146 ...
3147 >>> turtle.clearstamps(2)
3148 >>> turtle.clearstamps(-2)
3149 >>> turtle.clearstamps()
3150 """
3151 if n is None:
3152 toDelete = self.stampItems[:]
3153 elif n >= 0:
3154 toDelete = self.stampItems[:n]
3155 else:
3156 toDelete = self.stampItems[n:]
3157 for item in toDelete:
3158 self._clearstamp(item)
3159 self._update()
3160
3161 def _goto(self, end):
3162 """Move the pen to the point end, thereby drawing a line

Callers 1

_clearMethod · 0.95

Calls 2

_clearstampMethod · 0.95
_updateMethod · 0.95

Tested by

no test coverage detected