Advertisement
here2share

# Tk_Alpha_Art_Test_8.py

Oct 16th, 2021 (edited)
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.91 KB | None | 0 0
  1. # Tk_Alpha_Art_Test_8.py ZZZ
  2.  
  3. from Tkinter import *
  4. from PIL import Image, ImageTk
  5. from itertools import combinations
  6. import string
  7. import random
  8. import tempfile
  9. import webbrowser
  10.  
  11. srcfilename=tempfile.mktemp(".py", "1400x680_")
  12. srcfilename=srcfilename.rsplit('\\',1)[0]+'\\alpha1400x680art.py'
  13. print srcfilename
  14.  
  15. rndi = random.randint
  16. rndc = random.choice
  17.  
  18. ww = 1000
  19. hh = 600
  20.  
  21. root = Tk()
  22. root.title("Tk_Alpha_Art.py")
  23. root.geometry("%dx%d+0+0"%(ww,hh))
  24.  
  25. aaa = list(string.uppercase)
  26. bbb = list(string.lowercase)
  27.  
  28. ppp = [a+b for a in aaa+bbb for b in aaa+bbb]
  29. L = len(ppp)
  30. print L
  31. rgb2 = []
  32.  
  33. for y in range(hh):
  34.     for x in range(ww):
  35.         rgb2 += ['('+'+'.join([ppp[z%L]+'_' for z in (x+hh,y,(x+y)/2)])+')']
  36. 0
  37.  
  38. ttt = 'alpha_art = lambda zzzzz : '
  39.  
  40. abc = ttt+'['+','.join(rgb2)+']'
  41.  
  42. '''
  43. temp=open(srcfilename, 'w')
  44. temp.write(abc)
  45. temp.close()
  46. webbrowser.open_new_tab(srcfilename)
  47. import alpha1400x680art
  48. '''
  49.  
  50. exec(abc)
  51.  
  52. rainbow=[]
  53. def z(r,g,b):
  54.     rainbow.append((r,g,b))
  55. r,g,b=255,0,0
  56. for g in range(256):
  57.     z(r,g,b)
  58. for r in range(254, -1, -1):
  59.     z(r,g,b)
  60. for b in range(256):
  61.     z(r,g,b)
  62. for g in range(254, -1, -1):
  63.     z(r,g,b)
  64. for r in range(256):
  65.     z(r,g,b)
  66. for b in range(254, -1, -1):
  67.     z(r,g,b)
  68. rainbow = rainbow[1:-1]+rainbow[::-1]
  69. max_rgb=len(rainbow)
  70.  
  71.  
  72. def draw():
  73.     image.putdata(rgb_)
  74.     photo = ImageTk.PhotoImage(image)
  75.     canvas.create_image(0,0,image=photo,anchor=NW)
  76.     canvas.update()
  77. 0
  78.  
  79. canvas = Canvas(root, width=ww, height=hh)
  80. canvas.pack()
  81.  
  82. image = Image.new("RGB", (ww,hh), (255,255,255))
  83.  
  84. ccccc = 255**3*2
  85.  
  86. i = rndi(0,ccccc)
  87. t = 120000
  88. incr = range(-t,t)
  89. ccc = 50
  90. polar = rndc(incr)
  91.  
  92. c = 1
  93. while 1:
  94.     for p in ppp[:ww+hh]: ### 1600 passes instead of 600000 passes !!!
  95.         t = str(i)
  96.         i = (i+polar)
  97.         ccc = ccc-1
  98.         if not ccc:
  99.             ccc = rndi(10,60)
  100.             polar = rndc(incr)
  101.         exec(p+'_='+t)
  102.     rgb_ = alpha_art(0)
  103.     '''
  104.     '''
  105.     draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement