Bubbles


(graphic program)



from math import *
from random import *
from tkinter import *
#from transcol import *

#this is the "transcol" module:
def rgb(r,g,b):
     hr=list(hex(int(r)))
     hg=list(hex(int(g)))
     hb=list(hex(int(b)))
     hr.remove("0")
     hr.remove("x")
     hg.remove("0")
     hg.remove("x")
     hb.remove("0")
     hb.remove("x")
     if len(hr)<2:
          hr.insert(0,"0")
     if len(hg)<2:
          hg.insert(0,"0")
     if len(hb)<2:
          hb.insert(0,"0")
     return "#"+"".join(hr)+"".join(hg)+"".join(hb)

wx=1200
wy=800
f=Tk()
a=Canvas(f,width=wx,height=wy,bg=rgb(uniform(0,255),uniform(0,255),uniform(0,255)))
a.pack()
while True:
     x=uniform(0,wx)
     y=uniform(0,wy)
     r=uniform(0,255)
     g=uniform(0,255)
     b=uniform(0,255)
     mrad=floor(gauss(0,20))
     rad=mrad
     while rad>0:
          crad=rad-mrad/2
          a.create_oval(x+rad,y+rad,x-rad,y-rad,outline="",fill=rgb(128-(r*crad/mrad),128-(g*crad/mrad),128-(b*crad/mrad)))
          rad=rad-1
     a.update()
a.mainloop()
	
	

Return