如何在蟒蛇龟下面的圆圈周围添加发光?

问题描述 投票:0回答:0

我已经得到了圆圈的代码,但我只需要发光看起来像白色的闪亮太阳,但我尝试了很多不同的东西,但没有一个起作用

这是我到目前为止的代码,它创建了一个随机的白色太阳大小,这是我所需要的,但它还需要有像这样的发光 现在的代码包括日落:

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[i] + 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 loom like

turtle-graphics python-3.4 python-turtle glow
© www.soinside.com 2019 - 2024. All rights reserved.