Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- pygame.init()
- screen = pygame.display.set_mode((501, 501))
- coords = input().split(', ')
- last_coords = []
- for i in range(len(coords)):
- coord = coords[i]
- k = coord.split(';')
- a1, a2 = k[0][1:], k[1][:-1]
- if ',' in a1:
- a1 = a1[:a1.find(',')] + '.' + a1[a1.find(',') + 1:]
- if ',' in a2:
- a2 = a2[:a2.find(',')] + '.' + a2[a2.find(',') + 1:]
- a2 = float(a2)
- a1 = float(a1)
- last_coords.append((a1, a2))
- a1 = 250 + a1
- a2 = 501 - (250 + a2)
- coords[i] = (a1, a2)
- def increase():
- for i in range(len(coords)):
- m = last_coords[i]
- last_coords[i] = m[0] * 2, m[1] * 2
- a1 = 250 + m[0] * 2
- a2 = 501 - (250 + m[1] * 2)
- coords[i] = coords[i] = (a1, a2)
- running = True
- while running:
- screen.fill((0, 0, 0))
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- running = False
- if event.type == pygame.MOUSEBUTTONUP and (event.button == 4 or event.button == 5):
- increase()
- pygame.draw.polygon(screen, (255, 0, 0), coords, 1)
- pygame.display.flip()
- pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement