MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / onclick

Method onclick

tools/python-3.11.9-amd64/Lib/turtle.py:1350–1365  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1348 return sorted(self._shapes.keys())
1349
1350 def onclick(self, fun, btn=1, add=None):
1351 """Bind fun to mouse-click event on canvas.
1352
1353 Arguments:
1354 fun -- a function with two arguments, the coordinates of the
1355 clicked point on the canvas.
1356 btn -- the number of the mouse-button, defaults to 1
1357
1358 Example (for a TurtleScreen instance named screen)
1359
1360 >>> screen.onclick(goto)
1361 >>> # Subsequently clicking into the TurtleScreen will
1362 >>> # make the turtle move to the clicked point.
1363 >>> screen.onclick(None)
1364 """
1365 self._onscreenclick(fun, btn, add)
1366
1367 def onkey(self, fun, key):
1368 """Bind fun to key-release event of key.

Callers 1

clearMethod · 0.95

Calls 1

_onscreenclickMethod · 0.80

Tested by

no test coverage detected