【发布时间】:2018-01-28 12:49:57
【问题描述】:
我正在使用海龟图形,我想只清除屏幕的一部分并保持其余图像/绘图不变。
到目前为止,我一直在绘制一个白色矩形来清除图像的一部分,但这很慢,如果背景不是白色,我就不能使用这种方法。
这是我一直在使用的功能:
import turtle
t = turtle.Turtle()
def screen_clearer(coordinate_x, coordinate_y, length, width):
t.up()
t.goto(coordinate_x, coordinate_y)
t.color("white")
t.begin_fill()
t.setheading(0)
for i in range(2):
t.fd(length)
t.rt(90)
t.fd(width)
t.rt(90)
t.end_fill()
turtle 中是否有一个只清除部分屏幕的内置函数?我已经查看并没有发现任何东西,所以这就是我一直使用它的原因。
【问题讨论】:
-
我不这么认为!
-
谢谢,我很确定这是不可能的
-
我最终使用了你的解决方案)