Código para hacer estallar fuegos artificiales
# -*- codificación: utf-8 -*-importar matemáticas, aleatorio, tiempoimportar subprocesosimportar tkinter como tkimport re uuidFireworks=[]maxFireworks=8height, width=600, 600class fireworks(object): def __init__ (self, color, velocidad, ancho, alto): = uuid.uuid1() self.radius=random.randint(2, 4) ~4 píxeles self.color=color self.speed=speed .5-3,5 segundos self. status=0, status=0; después de la explosión, status=1; cuando status=100, la vida de los fuegos artificiales termina self.nParticle=random.randint(20, 30) self.center=[random.randint(0, width) -1), random.randint(0, altura-1)] self.oneParticle=[] (100 estados) self.rotTheta=random.uniform(0, 2*math.pi): x=a*cos( theta) , y=b*sin(theta)=[a, b]