有什么方法可以在没有功能的情况下使用 onkey 吗?
is there any way to use onkey without a function?
我正在尝试找到一种方法来直接通过以下操作使用 onkey 函数:
- 转发
- 离开
- 对
像那样:
screen.onkey(turtle.forward(50),"Up")
我偏爱partial
:
from functools import partial
screen.onkey(partial(turtle.left, 90), 'Left')
我正在尝试找到一种方法来直接通过以下操作使用 onkey 函数:
- 转发
- 离开
- 对
像那样:
screen.onkey(turtle.forward(50),"Up")
我偏爱partial
:
from functools import partial
screen.onkey(partial(turtle.left, 90), 'Left')