如何让Python的海龟屏幕识别右键?

问题描述 投票:0回答:1

我知道turtle.onscreenclick()默认为btn=1,即左键单击,但其他鼠标按钮的值是多少?我尝试使用turtle.onscreenclick(fun, 2)、(fun, "2") 和其他几种组合,但没有一个起作用。感谢您的任何反馈。

python turtle-graphics
1个回答
0
投票

我相信这段代码是有效的:

import turtle
wn=turtle.Screen()
def newfunc(x, y):
    print("Boo")

wn.onscreenclick(newfunc, 2)

(这只是一个演示,代码可以是任何东西。) 如果不起作用,那么问题一定是在你这边。

© www.soinside.com 2019 - 2024. All rights reserved.