Advertisement
here2share

# Tk_Alpha_Art_Test_1400x700.py

Nov 10th, 2021
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. # Tk_Alpha_Art_Test_1400x700.py
  2.  
  3. from Tkinter import *
  4. from PIL import Image, ImageTk
  5. import string
  6. import time
  7. import random
  8. import math
  9.  
  10. from itertools import product
  11.  
  12. ri_ = random.randint
  13. rs_ = random.shuffle
  14. rc_ = random.choice
  15.  
  16. tx_ =  time.time
  17.  
  18. ww = 1400
  19. hh = 700
  20.  
  21. root = Tk()
  22. root.title("Tk_Alpha_Art_Test_1400x700")
  23. root.geometry("%dx%d+-10+0"%(ww,hh))
  24.  
  25. alpha = string.letters
  26.  
  27. xy = [[] for z in range(ww*hh)]
  28.  
  29. abc = []
  30.  
  31. for x in alpha:
  32.     for y in alpha+'0123456789':
  33.         for z in alpha+'0123456789':
  34.             t = x+y+z
  35.             if not t.isalpha():
  36.                 exec(t+'=(255,255,0)')
  37.                 abc.append(t)
  38.                
  39. L = len(abc)
  40. print L
  41.  
  42. vars = []
  43. for y in range(hh):
  44.     for x in range(ww):
  45.         t = y*ww+x
  46.         a = y
  47.         b = x+ww
  48.         c = y+ww*2-x
  49.         d = y+ww*3+x
  50.         for z in [a,b,c,d]:
  51.             vars.append(abc[z])
  52.             xy[t].append(abc[z])
  53. 0
  54.  
  55. vars = list(set(vars))
  56.  
  57. matrix = '['+','.join(['{}+{}+{}+{}'.format(*z) for z in xy])+']'
  58.  
  59. p = 1079281
  60. ppp = p*2
  61. # print matrix
  62. exec("def o(): return "+str(matrix))
  63.  
  64. rainbow=[]
  65. def z(r,g,b):
  66.     rainbow.append((r,g,b))
  67. r,g,b=255,0,0
  68. for g in range(256):
  69.     z(r,g,b)
  70. for r in range(254, -1, -1):
  71.     z(r,g,b)
  72. for b in range(256):
  73.     z(r,g,b)
  74. for g in range(254, -1, -1):
  75.     z(r,g,b)
  76. for r in range(256):
  77.     z(r,g,b)
  78. for b in range(254, -1, -1):
  79.     z(r,g,b)
  80. Q = rainbow[1:-1]+rainbow[::-1]
  81. LQ = len(Q)
  82.  
  83. for k,v in enumerate(vars):
  84.     exec(v+'='+str(Q[k%LQ]))
  85.  
  86. def draw():
  87.     image.putdata(rgb)
  88.     photo = ImageTk.PhotoImage(image)
  89.     canvas.create_image(0,0,image=photo,anchor='nw')
  90.     canvas.update()
  91. 0
  92.  
  93. canvas = Canvas(root, width=ww, height=hh)
  94. canvas.pack()
  95.  
  96. image = Image.new("RGB", (ww,hh), (255,255,225))
  97.  
  98. ccc = (255**3)/4
  99.  
  100. while 1:
  101.     for _ in xrange(9999999):
  102.         for zzz in vars:
  103.             exec(zzz+'='+str(ri_(0,ccc)))
  104.         rgb = o()
  105.  
  106.         draw()
  107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement