from turtle import *
from random import*
while True:
forward(randint(1, 360))
right(randint(1, 360))
if xcor() < 0:
setx(20)
if ycor() < 0:
sety(20)
if xcor() > window_width():
setx(window_width()-20)
if ycor() > window_height():
sety(window_height()-20)
应该管用,20个由你选择。你知道吗
编辑:其中一篇重复文章中的解决方案可能更好
相关问题 更多 >
编程相关推荐