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

Method undo

Lib/turtle.py:3774–3801  ·  view source on GitHub ↗

undo (repeatedly) the last turtle action. No argument. undo (repeatedly) the last turtle action. Number of available undo actions is determined by the size of the undobuffer. Example (for a Turtle instance named turtle): >>> for i in range(4):

(self)

Source from the content-addressed store, hash-verified

3772 self.undobuffer.pop()
3773
3774 def undo(self):
3775 """undo (repeatedly) the last turtle action.
3776
3777 No argument.
3778
3779 undo (repeatedly) the last turtle action.
3780 Number of available undo actions is determined by the size of
3781 the undobuffer.
3782
3783 Example (for a Turtle instance named turtle):
3784 >>> for i in range(4):
3785 ... turtle.fd(50); turtle.lt(80)
3786 ...
3787 >>> for i in range(8):
3788 ... turtle.undo()
3789 ...
3790 """
3791 if self.undobuffer is None:
3792 return
3793 item = self.undobuffer.pop()
3794 action = item[0]
3795 data = item[1:]
3796 if action == "seq":
3797 while data:
3798 item = data.pop()
3799 self._undo(item[0], item[1:])
3800 else:
3801 self._undo(action, data)
3802
3803 turtlesize = shapesize
3804

Callers 1

demo2Function · 0.45

Calls 2

_undoMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected