from Tkinter import * from random import * root = Tk() def drawcircle(canv,x,y,radius,color): canv.create_oval(x-radius,y-radius,x+radius,y+radius,width=0,fill=color) canvas = Canvas(width=1000, height=600, bg='black') canvas.pack(expand=YES, fill=BOTH) text = canvas.create_text(50,10, text="Chaos Test") for runs in range(5): # try to use different values r=2.0 plotx=0 tmp = 0 while (r < 4.0): x = 0.12 #0.42 originally, 0.12 has more "chaos" for i in range(randint(20,40)): x = r*x*(1-x) if x < tmp: canvas.create_line(plotx, x*600, plotx, x*600-25, fill='blue', width=1) drawcircle(canvas, plotx, x*600, 1, 'white') else: canvas.create_line(plotx, x*600, plotx, x*600+25, fill='red', width=1) drawcircle(canvas, plotx, x*600, 1, 'white') tmp = x plotx=plotx+1 r=r+0.002 root.mainloop()