[Python] How would I add a glow around the circle below in python turtle?

Discussão em 'Python' iniciado por Stack, Dezembro 18, 2024.

  1. Stack

    Stack Membro Participativo

    I have got my code for the circle, but I just need the glow to look like a white shining sun.

    This is my code so far and it creates a randomized white sun size, which is what I need, but it needs to also glow:

    import turtle
    import random
    s = turtle.getscreen()
    t = turtle.Turtle()
    t.speed(100)
    t.pensize(4)
    from turtle import Screen, Turtle

    COLOR = (1, 0.7, 0.06)
    TARGET = (0.8, 0.09, 0.1)
    #Sunset
    screen = Screen()
    screen.tracer(False)
    screen.setup(width = 1.0, height = 1.0)

    WIDTH, HEIGHT = screen.window_width(), screen.window_height()

    deltas = [(hue - COLOR[index]) / HEIGHT for index, hue in enumerate(TARGET)]

    turtle = Turtle()
    turtle.color(COLOR)

    turtle.penup()
    turtle.goto(-WIDTH/2, HEIGHT/2)
    turtle.pendown()

    direction = 1

    for distance, y in enumerate(range(HEIGHT//2, -HEIGHT//2, -1)):

    turtle.forward(WIDTH * direction)
    turtle.color([COLOR + delta * distance for i, delta in enumerate(deltas)])
    turtle.sety(y)

    direction *= -1

    screen.tracer(True)

    #Sun
    def Sun (color):
    t.pu()
    t.goto(-400,-250)
    t.color(color)
    t.pd()
    rad = random.randint(100,220)
    t.begin_fill()
    t.circle(rad)
    t.end_fill()
    t.pu()
    Sun("White")


    This is the glowing white sun which I need it to look like

    Continue reading...

Compartilhe esta Página