首页 > 解决方案 > 乌龟 onscreenclick 在 Python 中返回什么?如何使区域成为“按钮”?

问题描述

是否turtle.onscreenclick返回 x 和 y 坐标?另外,如何制作一个矩形,如果我在其中单击会更改矩形的颜色?

标签: python-turtle

解决方案


turtle.onscreenclick将括号中的函数绑定到给定的键。

turtle.onscreenclick(fun, 1)其中 1 是左键单击,3 是右键单击。

说明: https ://docs.python.org/3/library/turtle.html#turtle.onscreenclick


推荐阅读