Python 中的乌龟出现错误。 turtle.Turtle

Got a error with turtle in Python. turtle.Turtle

我几天前开始编程,今天我尝试使用 python 来制作游戏 'Pong'。 但是由于我是初学者,所以我找不到代码有什么问题。 当我尝试创建 turtle.Turtle 时,Pycharm 表示代码无法访问。

    # Game Pong

import turtle

wn = turtle.Screen()
wn.title("Quarentena 21/03")
wn.setup(width=800, height=600)
wn.bgcolor("black")
wn.tracer(0)

# Main Game Loop
while True:
    wn.update()

# Paddle A
paddle_a = turtle.Turtle()
paddle_a.shape("square")
paddle_a.speed(0)
paddle_a.color('green')
paddle_a.penup()

是的,代码无法访问。除非你放一些东西来打破循环,否则 'while True' 会一直持续下去,因为默认条件总是 True 除非你将它设置为 false。所以你无法到达循环下面的代码。编程愉快! :)