怎么改变颜色?
import turtle
sell_volume = [50, 89, 97, 240, 300, 260, 220]
def draw_bar_chart(turtle, height):
turtle.left(90)
turtle.forward(height)
turtle.right(90)
turtle.forward(30)
turtle.right(90)
turtle.forward(height)
turtle.left(90)
# Set up the screen (window)
turtle.setup(width=600, height=800)
# Create an instance of the function
# Create Alex
Alex = turtle.Turtle()
for volume in sell_volume:
draw_bar_chart(Alex, volume)
Alex.penup()
Alex.forward(50)
Alex.pendown()
turtle.done()
望采纳,谢谢!
你可以在画每列图表时设置画笔颜色,例如:
turtle.pencolor('red')