MCPcopy Index your code
hub / github.com/python/cpython / ondrag

Method ondrag

Lib/turtle.py:3721–3739  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 1

__init__Method · 0.80

Calls 1

_ondragMethod · 0.80

Tested by

no test coverage detected