我想用烏龜來創建一個正方形,同時嘗試給烏龜窗口一個顏色「黑色」。我收到錯誤,任何輸入都會有幫助。用Python中的turtle.bgcolor()獲取錯誤
下面是我的代碼:
import turtle
def draw_square():
window = turtle._Screen
window.bgcolor("black")
brad = turtle.Turtle()
brad.forward(100)
window.exitonclick()
draw_square()
下面是我在錯誤得到:
color = self._bgcolor(color)
AttributeError: 'str' object has no attribute '_bgcolor'