【发布时间】:2022-12-20 03:14:21
【问题描述】:
我有一个程序(如下)将在 Trinket.io 中运行并将输出输出到海龟图形窗口,但是,当在 VS Code 中运行时它不会提供输出。即使我插入输入语句,它也不会向终端提供任何输出。我尝试用 trtl.mainloop() 替换最后两行,但这也没有解决问题。
# a116_buggy_image.py
import turtle as trtl
# instead of a descriptive name of the turtle such as painter,
# a less useful variable name x is used
x = trtl.Turtle()
x.pensize(40)
x.circle(20)
w = 6
y = 70
z = 380 / w
x.pensize(5)
n = 0
while (n < w):
x.goto(0,0)
x.setheading(z*n)
x.forward(y)
n = n + 1
x.hideturtle()
wn = trtl.Screen()
wn.mainloop()
【问题讨论】: