[Python] Filling a star shape with Turtle

Discussão em 'Python' iniciado por Stack, Março 16, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to Python and I'm learning graphics using turtle. I'm attempting to color a star I've drawn, but the color won't fill for every part of the star.

    Here is my code:

    def red_star():
    f.penup()
    f.goto(145,-130)

    f.fillcolor("red")
    f.begin_fill()

    for i in range(5):
    f.fd(100)
    f.rt(144)

    f.end_fill()
    f.pendown()

    red_star()


    Here is what I produce when I run the program:

    [​IMG]

    Continue reading...

Compartilhe esta Página