我试着用鼠标拖动物体。因此,当我让它们使用鼠标时,它们就有了鼠标的新位置。我有两个问题。1.在Glowscript中,它会运行,但没有松开鼠标的操作。当我单击它时,我可以拖动它。但当我想松开鼠标时,它会继续拖动对象,直到我关闭程序。2.我不能在Python编辑器中运行它,bc我得到以下错误:scene.bind("mousedown", def():
完整代码:
drag=False
R = vec(0,0,0)
scene.bind("mousedown", def():
global drag
drag=True
scende.bind("mouseup", def():
global drag
drag=False
)
)
while (True):
rate(framerate)
if drag:
R=scene.mouse.pos
e.pos=R
if running当然,这段代码中还缺少一些东西。在它上面,我生成常量和对象,在if running下,函数是。这是拖动事件的代码,错误之处在于此。
发布于 2018-09-08 02:42:21
drag=False
R = vec(0,0,0)
scene.bind("mousedown", def():
global drag
drag=True
scene.bind("mouseup", def():
global drag
drag=False
)
)
while (True):
rate(framerate)
if drag:
R=scene.mouse.pos
e.pos=R
if runninghttps://stackoverflow.com/questions/52227235
复制相似问题