我正在尝试编写一段代码,根据您在屏幕上单击的位置来制作球或正方形(“正方形”和“圆形”已在前面定义):
def squareball(x,y):
if x <0:
square
if x >=0:
circle
canvas.onclick(squareball,2)
但是,当我单击鼠标中键时,什么也没有发生。
最佳答案
访问您的旧函数,square
和circle
。
如果它们是这样的:
def <func_name>:
,插入括号,使其成为 def <func_name>():
执行或不执行此操作后,请执行 square
至square()
和circle
至circle()
在 if/else
声明。
摘要:您没有调用您的函数。
关于python - 基本鼠标点击代码 - 需要修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44617932/