为什么形状的颜色没有变为红色?

时间:2020-05-19 00:01:58

标签: python

我一直在尝试使正方形的颜色显示为红色,但是只能显示为黑色

import turtle

class Shapes:
    def __init__(self, length, sides=4, color="red"):
        self.length = length
        self.sides = sides
        self.color = color

        self.inside_angle_sum = (self.sides - 2) * 180
        self.individual_angle = self.inside_angle_sum / self.sides

    def drawing(self):
        turtle.color = self.color  #do not get why this wont run

        for i in range(self.sides):
            turtle.forward(self.length)
            turtle.left(180 - self.individual_angle)

square = Shapes(100, 4)
square.drawing()

1 个答案:

答案 0 :(得分:0)

turtle.color需要():

df1 <- structure(list(Date = c("2020-01-01", "2020-01-02", "2020-01-03", 
"2020-01-04", "2020-01-05", "2020-01-06", "2020-01-07", "2020-01-08", 
"2020-01-09", "2020-01-10"), Price = c(500L, 550L, 480L, 420L, 
450L, 390L, 430L, 480L, 490L, 485L)), class = "data.frame", row.names = c(NA, 
-10L))


df2 <- structure(list(Date = c("2020-01-01", "2020-01-04", "2020-01-06", 
"2020-01-07", "2020-01-10"), Price2 = c(50L, 20L, 90L, 30L, 80L
)), class = "data.frame", row.names = c(NA, -5L))