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)
| 3466 | self._update() |
| 3467 | |
| 3468 | def ondrag(self, fun, btn=1, add=None): |
| 3469 | """Bind fun to mouse-move event on this turtle on canvas. |
| 3470 | |
| 3471 | Arguments: |
| 3472 | fun -- a function with two arguments, to which will be assigned |
| 3473 | the coordinates of the clicked point on the canvas. |
| 3474 | btn -- number of the mouse-button defaults to 1 (left mouse button). |
| 3475 | |
| 3476 | Every sequence of mouse-move-events on a turtle is preceded by a |
| 3477 | mouse-click event on that turtle. |
| 3478 | |
| 3479 | Example (for a Turtle instance named turtle): |
| 3480 | >>> turtle.ondrag(turtle.goto) |
| 3481 | |
| 3482 | Subsequently clicking and dragging a Turtle will move it |
| 3483 | across the screen thereby producing handdrawings (if pen is |
| 3484 | down). |
| 3485 | """ |
| 3486 | self.screen._ondrag(self.turtle._item, fun, btn, add) |
| 3487 | |
| 3488 | |
| 3489 | def _undo(self, action, data): |