Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import pygame
  2.  
  3. pygame.init()
  4. screen = pygame.display.set_mode((501, 501))
  5. coords = input().split(', ')
  6. last_coords = []
  7. for i in range(len(coords)):
  8. coord = coords[i]
  9. k = coord.split(';')
  10. a1, a2 = k[0][1:], k[1][:-1]
  11. if ',' in a1:
  12. a1 = a1[:a1.find(',')] + '.' + a1[a1.find(',') + 1:]
  13. if ',' in a2:
  14. a2 = a2[:a2.find(',')] + '.' + a2[a2.find(',') + 1:]
  15. a2 = float(a2)
  16. a1 = float(a1)
  17. last_coords.append((a1, a2))
  18. a1 = 250 + a1
  19. a2 = 501 - (250 + a2)
  20. coords[i] = (a1, a2)
  21.  
  22. def increase():
  23. for i in range(len(coords)):
  24. m = last_coords[i]
  25. last_coords[i] = m[0] * 2, m[1] * 2
  26. a1 = 250 + m[0] * 2
  27. a2 = 501 - (250 + m[1] * 2)
  28. coords[i] = coords[i] = (a1, a2)
  29.  
  30.  
  31. running = True
  32. while running:
  33. screen.fill((0, 0, 0))
  34. for event in pygame.event.get():
  35. if event.type == pygame.QUIT:
  36. running = False
  37. if event.type == pygame.MOUSEBUTTONUP and (event.button == 4 or event.button == 5):
  38. increase()
  39. pygame.draw.polygon(screen, (255, 0, 0), coords, 1)
  40. pygame.display.flip()
  41.  
  42. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement