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

Method undo

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

(self)

Source from the content-addressed store, hash-verified

3638 self.undobuffer.pop()
3639
3640 def undo(self):
3641 """undo (repeatedly) the last turtle action.
3642
3643 No argument.
3644
3645 undo (repeatedly) the last turtle action.
3646 Number of available undo actions is determined by the size of
3647 the undobuffer.
3648
3649 Example (for a Turtle instance named turtle):
3650 >>> for i in range(4):
3651 ... turtle.fd(50); turtle.lt(80)
3652 ...
3653 >>> for i in range(8):
3654 ... turtle.undo()
3655 ...
3656 """
3657 if self.undobuffer is None:
3658 return
3659 item = self.undobuffer.pop()
3660 action = item[0]
3661 data = item[1:]
3662 if action == "seq":
3663 while data:
3664 item = data.pop()
3665 self._undo(item[0], item[1:])
3666 else:
3667 self._undo(action, data)
3668
3669 turtlesize = shapesize
3670

Callers 1

demo2Function · 0.45

Calls 2

_undoMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected