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)
| 3441 | self._update() |
| 3442 | |
| 3443 | def onrelease(self, fun, btn=1, add=None): |
| 3444 | """Bind fun to mouse-button-release event on this turtle on canvas. |
| 3445 | |
| 3446 | Arguments: |
| 3447 | fun -- a function with two arguments, to which will be assigned |
| 3448 | the coordinates of the clicked point on the canvas. |
| 3449 | btn -- number of the mouse-button defaults to 1 (left mouse button). |
| 3450 | |
| 3451 | Example (for a MyTurtle instance named joe): |
| 3452 | >>> class MyTurtle(Turtle): |
| 3453 | ... def glow(self,x,y): |
| 3454 | ... self.fillcolor("red") |
| 3455 | ... def unglow(self,x,y): |
| 3456 | ... self.fillcolor("") |
| 3457 | ... |
| 3458 | >>> joe = MyTurtle() |
| 3459 | >>> joe.onclick(joe.glow) |
| 3460 | >>> joe.onrelease(joe.unglow) |
| 3461 | |
| 3462 | Clicking on joe turns fillcolor red, unclicking turns it to |
| 3463 | transparent. |
| 3464 | """ |
| 3465 | self.screen._onrelease(self.turtle._item, fun, btn, add) |
| 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. |
nothing calls this directly
no test coverage detected