Bind fun to mouse-move event on this turtle on canvas. Arguments: fun -- a function with two arguments, to which will be assigned the coordinates of the clicked point on the canvas. btn -- number of the mouse-button defaults to 1 (left mouse button).
(self, fun, btn=1, add=None)
| 3719 | self._update() |
| 3720 | |
| 3721 | def ondrag(self, fun, btn=1, add=None): |
| 3722 | """Bind fun to mouse-move event on this turtle on canvas. |
| 3723 | |
| 3724 | Arguments: |
| 3725 | fun -- a function with two arguments, to which will be assigned |
| 3726 | the coordinates of the clicked point on the canvas. |
| 3727 | btn -- number of the mouse-button defaults to 1 (left mouse button). |
| 3728 | |
| 3729 | Every sequence of mouse-move-events on a turtle is preceded by a |
| 3730 | mouse-click event on that turtle. |
| 3731 | |
| 3732 | Example (for a Turtle instance named turtle): |
| 3733 | >>> turtle.ondrag(turtle.goto) |
| 3734 | |
| 3735 | Subsequently clicking and dragging a Turtle will move it |
| 3736 | across the screen thereby producing handdrawings (if pen is |
| 3737 | down). |
| 3738 | """ |
| 3739 | self.screen._ondrag(self.turtle._item, fun, btn, add) |
| 3740 | |
| 3741 | |
| 3742 | def _undo(self, action, data): |