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

Method _onrelease

Lib/turtle.py:612–629  ·  view source on GitHub ↗

Bind fun to mouse-button-release event on turtle. fun must be a function with two arguments, the coordinates of the point on the canvas where mouse button is released. num, the number of the mouse-button defaults to 1 If a turtle is clicked, first _onclick-event will

(self, item, fun, num=1, add=None)

Source from the content-addressed store, hash-verified

610 self.cv.tag_bind(item, "<Button-%s>" % num, eventfun, add)
611
612 def _onrelease(self, item, fun, num=1, add=None):
613 """Bind fun to mouse-button-release event on turtle.
614 fun must be a function with two arguments, the coordinates
615 of the point on the canvas where mouse button is released.
616 num, the number of the mouse-button defaults to 1
617
618 If a turtle is clicked, first _onclick-event will be performed,
619 then _onscreensclick-event.
620 """
621 if fun is None:
622 self.cv.tag_unbind(item, "<Button%s-ButtonRelease>" % num)
623 else:
624 def eventfun(event):
625 x, y = (self.cv.canvasx(event.x)/self.xscale,
626 -self.cv.canvasy(event.y)/self.yscale)
627 fun(x, y)
628 self.cv.tag_bind(item, "<Button%s-ButtonRelease>" % num,
629 eventfun, add)
630
631 def _ondrag(self, item, fun, num=1, add=None):
632 """Bind fun to mouse-move-event (with pressed mouse button) on turtle.

Callers 1

onreleaseMethod · 0.80

Calls 2

tag_unbindMethod · 0.45
tag_bindMethod · 0.45

Tested by

no test coverage detected