Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. from PIL import Image, ImageDraw
  2.  
  3. back = str(input())
  4. c1 = str(input())
  5. c2 = str(input())
  6. c3 = str(input())
  7. n = int(input())
  8.  
  9. l = 25*(2**n)
  10.  
  11. img = Image.new('RGB', (l, l), back)
  12. dib = ImageDraw.Draw(img)
  13. i = 1
  14.  
  15. if (n != 0):
  16.     dib.ellipse([0, 0, l/2**i-1, l/2**i-1], c2)
  17.     dib.ellipse([l/2, 0, l-1, l/2-1], c3)
  18.     dib.ellipse([0, l/2, l/2-1, l-1], c1)
  19.  
  20. v = l/2**i
  21.  
  22. while (n > 1)
  23.     d = (l/(2**(i+1)) + v) - v
  24.     dib.ellipse([v, v, (l/(2**(i+1)) + v)-1, (l/(2**(i+1)) + v)-1], c2)
  25.     dib.ellipse([v+d, v, l-1,(l/(2**(i+1)) + v)-1], c3)
  26.     print ("x2 ", l-1, " y2 ", (l/(2**(i+1)) + v)-1)
  27.     dib.ellipse([v, v+d, (l/(2**(i+1)) + v)-1, l-1], c1)
  28.    
  29.     v = (l/(2**(i+1)) + v)
  30.     i += 1
  31.     n -= 1
  32.  
  33. img.save('output.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement