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

Method _clearstamp

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

does the work for clearstamp() and clearstamps()

(self, stampid)

Source from the content-addressed store, hash-verified

3094 return stitem
3095
3096 def _clearstamp(self, stampid):
3097 """does the work for clearstamp() and clearstamps()
3098 """
3099 if stampid in self.stampItems:
3100 if isinstance(stampid, tuple):
3101 for subitem in stampid:
3102 self.screen._delete(subitem)
3103 else:
3104 self.screen._delete(stampid)
3105 self.stampItems.remove(stampid)
3106 # Delete stampitem from undobuffer if necessary
3107 # if clearstamp is called directly.
3108 item = ("stamp", stampid)
3109 buf = self.undobuffer
3110 if item not in buf.buffer:
3111 return
3112 index = buf.buffer.index(item)
3113 buf.buffer.remove(item)
3114 if index <= buf.ptr:
3115 buf.ptr = (buf.ptr - 1) % buf.bufsize
3116 buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None])
3117
3118 def clearstamp(self, stampid):
3119 """Delete stamp with given stampid

Callers 2

clearstampMethod · 0.95
clearstampsMethod · 0.95

Calls 4

_deleteMethod · 0.45
removeMethod · 0.45
indexMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected