SHARE
TWEET

Simple pygame screenhack

a guest Apr 24th, 2012 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/local/bin/python2.7                                                      
  2.  
  3. import pygame
  4. import math
  5.  
  6. pygame.init()
  7.  
  8. Width = 1920 - 2
  9. Height = 1080 - 24
  10. mid_x = Width / 2
  11. mid_y = Height / 2
  12. radius = min(mid_x,mid_y)
  13.  
  14. Black = (0,0,0)
  15. White = (255,255,255)
  16. Green = (0,255,0)
  17.  
  18. screen = pygame.display.set_mode((Width, Height))
  19. screen.fill(White)
  20.  
  21. pygame.draw.line(screen, Black, (mid_x, 0), (mid_x, Height))
  22. pygame.draw.line(screen, Black, (0, mid_y), (Width, mid_y))
  23.  
  24. pygame.display.update()
  25.  
  26. for angle in range(0,360):
  27.     phi = math.radians(angle)
  28.     x = math.sin(phi)
  29.     y = math.cos(phi)
  30.     xx = mid_x + (x * radius)
  31.     yy = mid_y - (y * radius)
  32.     pygame.draw.line(screen, Green, (mid_x, mid_y), (xx, yy))
  33.     pygame.display.update()
  34.  
  35.  
  36. while 1:
  37.     event = pygame.event.poll()
  38.  
  39.     if event.type == pygame.MOUSEBUTTONDOWN:
  40.         pygame.quit()
  41.         sys.exit()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top