Advertisement
here2share

# Tk_Alpha_Art_Test_4.py

Oct 4th, 2021
1,532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. # Tk_Alpha_Art_Test_4.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 = y*ww+x
  27.         abc[t] += oALPHA[(x**2)%L]
  28.         abc[t] += oALPHA[((x**2)+26-y)%L]
  29.        
  30.         #t = x*hh+y
  31.         abc[t] += oALPHA[(y**2)%L]
  32.         abc[t] += oALPHA[((y**2)+26-x)%L]
  33. 0
  34.  
  35. abc = ['({}+{}+{}+{})'.format(*z) for z in abc]
  36. #print abc
  37.  
  38. ttt = 'alpha_art = lambda zzz : '
  39.  
  40. abc = ttt+'['+','.join(abc)+']'
  41.  
  42. exec(abc)
  43.  
  44. def draw():
  45.     image.putdata(rgb)
  46.     photo = ImageTk.PhotoImage(image)
  47.     canvas.create_image(0,0,image=photo,anchor=NW)
  48.     canvas.update()
  49. 0
  50.  
  51. canvas = Canvas(root, width=ww, height=hh)
  52. canvas.pack()
  53.  
  54. image = Image.new("RGB", (ww,hh), (255,255,255))
  55.  
  56. vvv = 16581375
  57. i = 16581375/4
  58. print
  59. while i > 0:
  60.     for zzz in alpha:
  61.         ttt = str(rnd(0,vvv/4))
  62.         # ttt = str(i)
  63.         exec(zzz+'='+ttt)
  64.         i -= 1
  65.     rgb = alpha_art(0)
  66.     draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement