Python 3.x 为什么我的乌龟窗马上就关上了? 导入海龟 维德乌龟=乌龟。乌龟() def square(): 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 大象重量=3000 蚂蚁重量=0.1 如果大象重量

Python 3.x 为什么我的乌龟窗马上就关上了? 导入海龟 维德乌龟=乌龟。乌龟() def square(): 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 乌龟前进(100) 维德乌龟。右(90) 大象重量=3000 蚂蚁重量=0.1 如果大象重量,python-3.x,python-turtle,Python 3.x,Python Turtle,为什么我的turtle窗口在Visual Studio 2019社区版中打开后会立即关闭,但在repl.it中不会立即关闭?在脚本末尾添加input(),使其等待Enter键。这可能与您在pc上安装的python有关 import turtle ved_turtle = turtle.Turtle() def square(): ved_turtle.forward(100) ved_turtle.right(90) ved_turtle.forward(100)

为什么我的turtle窗口在Visual Studio 2019社区版中打开后会立即关闭,但在repl.it中不会立即关闭?

在脚本末尾添加
input()
,使其等待Enter键。

这可能与您在pc上安装的python有关
import turtle

ved_turtle = turtle.Turtle()
def square():
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)

elephant_weight = 3000
ant_weight = 0.1

if elephant_weight < ant_weight:
    square()
else:
    ved_turtle.forward(0)