我用了泽尔的”图形.py“文件。我用Thonny。我想要 使用函数“getMouse()&getMouseNow()”,但出现以下消息。我该怎么办?帮助我!在
代码:
from graphics import *
def draw():
win = GraphWin("My Circle", 500, 500)
circle = Circle(Point(150,150), 50)
circle.draw(win)
p = win.getMouse()
x = p.x
y = p.y
circle.moveTo(x,y)
draw()
输出:
创建一个具有上述尺寸的窗口,并在其中创建一个圆。 点击窗口后。。。在
^{pr2}$
没有
moveTo()
方法,您也不需要它,move()
方法应该按照您想要的方式进行,如果您相对于对象的中心位置进行移动:函数的作用是:返回一个Point(http://mcsp.wartburg.edu/zelle/python/graphics.py)的实例,从中可以提取x和y
我希望这有帮助:)
相关问题 更多 >
编程相关推荐