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

Method onrelease

Lib/turtle.py:3696–3719  ·  view source on GitHub ↗

Bind fun to mouse-button-release 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

3694 self._update()
3695
3696 def onrelease(self, fun, btn=1, add=None):
3697 """Bind fun to mouse-button-release event on this turtle on canvas.
3698
3699 Arguments:
3700 fun -- a function with two arguments, to which will be assigned
3701 the coordinates of the clicked point on the canvas.
3702 btn -- number of the mouse-button defaults to 1 (left mouse button).
3703
3704 Example (for a MyTurtle instance named joe):
3705 >>> class MyTurtle(Turtle):
3706 ... def glow(self,x,y):
3707 ... self.fillcolor("red")
3708 ... def unglow(self,x,y):
3709 ... self.fillcolor("")
3710 ...
3711 >>> joe = MyTurtle()
3712 >>> joe.onclick(joe.glow)
3713 >>> joe.onrelease(joe.unglow)
3714
3715 Clicking on joe turns fillcolor red, unclicking turns it to
3716 transparent.
3717 """
3718 self.screen._onrelease(self.turtle._item, fun, btn, add)
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.

Callers

nothing calls this directly

Calls 2

_updateMethod · 0.95
_onreleaseMethod · 0.80

Tested by

no test coverage detected