gpt4 book ai didi

python - 基本鼠标点击代码 - 需要修复

转载 作者:太空宇宙 更新时间:2023-11-03 15:06:23 25 4
gpt4 key购买 nike

我正在尝试编写一段代码,根据您在屏幕上单击的位置来制作球或正方形(“正方形”和“圆形”已在前面定义):

def squareball(x,y):
if x <0:
square
if x >=0:
circle
canvas.onclick(squareball,2)

但是,当我单击鼠标中键时,什么也没有发生。

最佳答案

访问您的旧函数,squarecircle 。如果它们是这样的: def <func_name>: ,插入括号,使其成为 def <func_name>():

执行或不执行此操作后,请执行 squaresquare()circlecircle()if/else声明。

摘要:您没有调用您的函数。

关于python - 基本鼠标点击代码 - 需要修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44617932/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com