Advertisement
here2share

# Tk_Alpha_Art.py ZZZ

Sep 28th, 2021 (edited)
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. # Tk_Alpha_Art_Test_2.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.  
  9. rnd = random.randint
  10.  
  11. ww = 800
  12. hh = 600
  13.  
  14. root = Tk()
  15. root.title("Tk_Alpha_Art.py")
  16. root.geometry("%dx%d+0+0"%(ww,hh))
  17.  
  18. alpha = list(string.letters)
  19. oALPHA = alpha + alpha[:-1:-1]
  20. L = len(oALPHA)
  21.  
  22. abc = [[] for z in range(ww*hh)]
  23. L2 = len(abc)
  24. for y in range(hh):
  25.     for x in range(ww):
  26.         t = x*hh+y
  27.         abc[t] += oALPHA[x%L]
  28.         abc[t] += oALPHA[(x-y)%L]
  29.        
  30.         t = x+y*ww
  31.         abc[t] += oALPHA[x%L]
  32.         abc[t] += oALPHA[(x)%L]
  33. 0
  34.  
  35. abc = ['(({}*{})%({}+{}))'.format(*z) for z in abc]
  36.  
  37. ttt = 'alpha_art = lambda zzz : '
  38.  
  39. abc = ttt+'['+','.join(abc)+']'
  40.  
  41. exec(abc)
  42.  
  43. def draw():
  44.     image.putdata(rgb)
  45.     photo = ImageTk.PhotoImage(image)
  46.     canvas.create_image(0,0,image=photo,anchor=NW)
  47.     canvas.update()
  48. 0
  49.  
  50. canvas = Canvas(root, width=ww, height=hh)
  51. canvas.pack()
  52.  
  53. image = Image.new("RGB", (ww,hh), (255,255,255))
  54.  
  55. vvv = 16777215
  56. while 1:
  57.     for zzz in alpha:
  58.         ttt = str(rnd(0,vvv/2))
  59.         exec(zzz+'='+ttt)
  60.     rgb = alpha_art(0)
  61.     draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement