Move the pen to the point end, thereby drawing a line if pen is down. All other methods for turtle movement depend on this one.
(self, end)
| 3041 | self._update() |
| 3042 | |
| 3043 | def _goto(self, end): |
| 3044 | """Move the pen to the point end, thereby drawing a line |
| 3045 | if pen is down. All other methods for turtle movement depend |
| 3046 | on this one. |
| 3047 | """ |
| 3048 | ## Version with undo-stuff |
| 3049 | go_modes = ( self._drawing, |
| 3050 | self._pencolor, |
| 3051 | self._pensize, |
| 3052 | isinstance(self._fillpath, list)) |
| 3053 | screen = self.screen |
| 3054 | undo_entry = ("go", self._position, end, go_modes, |
| 3055 | (self.currentLineItem, |
| 3056 | self.currentLine[:], |
| 3057 | screen._pointlist(self.currentLineItem), |
| 3058 | self.items[:]) |
| 3059 | ) |
| 3060 | if self.undobuffer: |
| 3061 | self.undobuffer.push(undo_entry) |
| 3062 | start = self._position |
| 3063 | if self._speed and screen._tracing == 1: |
| 3064 | diff = (end-start) |
| 3065 | diffsq = (diff[0]*screen.xscale)**2 + (diff[1]*screen.yscale)**2 |
| 3066 | nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) |
| 3067 | delta = diff * (1.0/nhops) |
| 3068 | for n in range(1, nhops): |
| 3069 | if n == 1: |
| 3070 | top = True |
| 3071 | else: |
| 3072 | top = False |
| 3073 | self._position = start + delta * n |
| 3074 | if self._drawing: |
| 3075 | screen._drawline(self.drawingLineItem, |
| 3076 | (start, self._position), |
| 3077 | self._pencolor, self._pensize, top) |
| 3078 | self._update() |
| 3079 | if self._drawing: |
| 3080 | screen._drawline(self.drawingLineItem, ((0, 0), (0, 0)), |
| 3081 | fill="", width=self._pensize) |
| 3082 | # Turtle now at end, |
| 3083 | if self._drawing: # now update currentLine |
| 3084 | self.currentLine.append(end) |
| 3085 | if isinstance(self._fillpath, list): |
| 3086 | self._fillpath.append(end) |
| 3087 | ###### vererbung!!!!!!!!!!!!!!!!!!!!!! |
| 3088 | self._position = end |
| 3089 | if self._creatingPoly: |
| 3090 | self._poly.append(end) |
| 3091 | if len(self.currentLine) > 42: # 42! answer to the ultimate question |
| 3092 | # of life, the universe and everything |
| 3093 | self._newLine() |
| 3094 | self._update() #count=True) |
| 3095 | |
| 3096 | def _undogoto(self, entry): |
| 3097 | """Reverse a _goto. Used for undo() |
nothing calls this directly
no test coverage detected