Advertisement
here2share

# Tk_Alpha_Art_Test_5.py

Oct 15th, 2021
1,176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. # Tk_Alpha_Art_Test_5.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. rnd = random.randint
  16.  
  17. ww = 1200
  18. hh = 600
  19.  
  20. root = Tk()
  21. root.title("Tk_Alpha_Art.py")
  22. root.geometry("%dx%d+0+0"%(ww,hh))
  23.  
  24. aaa = list(string.uppercase)
  25. bbb = list(string.lowercase)
  26.  
  27. ppp = [a+b for a in aaa+bbb for b in aaa+bbb]
  28. L = len(ppp)
  29. print L
  30. rgb2 = []
  31.  
  32. for y in range(hh):
  33.     for x in range(ww):
  34.         rgb2 += ['('+'+'.join([ppp[z%L]+'_' for z in (x+hh,y)])+')']
  35. 0
  36.  
  37. ttt = 'alpha_art = lambda zzzzz : '
  38.  
  39. abc = ttt+'['+','.join(rgb2)+']'
  40.  
  41. '''
  42. temp=open(srcfilename, 'w')
  43. temp.write(abc)
  44. temp.close()
  45. webbrowser.open_new_tab(srcfilename)
  46. import alpha1400x680art
  47. '''
  48.  
  49. exec(abc)
  50.  
  51. def draw():
  52.     image.putdata(rgb_)
  53.     photo = ImageTk.PhotoImage(image)
  54.     canvas.create_image(0,0,image=photo,anchor=NW)
  55.     canvas.update()
  56. 0
  57.  
  58. canvas = Canvas(root, width=ww, height=hh)
  59. canvas.pack()
  60.  
  61. image = Image.new("RGB", (ww,hh), (255,255,255))
  62.  
  63. ccccc = 255**3
  64.  
  65. while 1:
  66.     for p in ppp:
  67.         t = str(rnd(0,ccccc))
  68.         try:
  69.             exec(p+'_='+t)
  70.         except:
  71.             0
  72.     rgb_ = alpha_art(0)
  73.     '''
  74.     '''
  75.     draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement