Does the main part of the work for undo()
(self, action, data)
| 3740 | |
| 3741 | |
| 3742 | def _undo(self, action, data): |
| 3743 | """Does the main part of the work for undo() |
| 3744 | """ |
| 3745 | if self.undobuffer is None: |
| 3746 | return |
| 3747 | if action == "rot": |
| 3748 | angle, degPAU = data |
| 3749 | self._rotate(-angle*degPAU/self._degreesPerAU) |
| 3750 | self.undobuffer.pop() |
| 3751 | elif action == "stamp": |
| 3752 | stitem = data[0] |
| 3753 | self.clearstamp(stitem) |
| 3754 | elif action == "go": |
| 3755 | self._undogoto(data) |
| 3756 | elif action in ["wri", "dot"]: |
| 3757 | item = data[0] |
| 3758 | self.screen._delete(item) |
| 3759 | self.items.remove(item) |
| 3760 | elif action == "dofill": |
| 3761 | item = data[0] |
| 3762 | self.screen._drawpoly(item, ((0, 0),(0, 0),(0, 0)), |
| 3763 | fill="", outline="") |
| 3764 | elif action == "beginfill": |
| 3765 | item = data[0] |
| 3766 | self._fillitem = self._fillpath = None |
| 3767 | if item in self.items: |
| 3768 | self.screen._delete(item) |
| 3769 | self.items.remove(item) |
| 3770 | elif action == "pen": |
| 3771 | TPen.pen(self, data[0]) |
| 3772 | self.undobuffer.pop() |
| 3773 | |
| 3774 | def undo(self): |
| 3775 | """undo (repeatedly) the last turtle action. |