Bind fun to mouse-click event on canvas. Arguments: fun -- a function with two arguments, the coordinates of the clicked point on the canvas. btn -- the number of the mouse-button, defaults to 1 Example (for a TurtleScreen instance named screen)
(self, fun, btn=1, add=None)
| 1375 | return sorted(self._shapes.keys()) |
| 1376 | |
| 1377 | def onclick(self, fun, btn=1, add=None): |
| 1378 | """Bind fun to mouse-click event on canvas. |
| 1379 | |
| 1380 | Arguments: |
| 1381 | fun -- a function with two arguments, the coordinates of the |
| 1382 | clicked point on the canvas. |
| 1383 | btn -- the number of the mouse-button, defaults to 1 |
| 1384 | |
| 1385 | Example (for a TurtleScreen instance named screen) |
| 1386 | |
| 1387 | >>> screen.onclick(goto) |
| 1388 | >>> # Subsequently clicking into the TurtleScreen will |
| 1389 | >>> # make the turtle move to the clicked point. |
| 1390 | >>> screen.onclick(None) |
| 1391 | """ |
| 1392 | self._onscreenclick(fun, btn, add) |
| 1393 | |
| 1394 | def onkey(self, fun, key): |
| 1395 | """Bind fun to key-release event of key. |