Advertisement
cookertron

Fake Polygraph Python Pygame

Mar 26th, 2020
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. import pygame
  2. import time
  3.  
  4. # define display surface           
  5. W, H = 1280, 720
  6.  
  7. # initialise display
  8. pygame.init()
  9. CLOCK = pygame.time.Clock()
  10. DS = pygame.display.set_mode((W, H))
  11. FPS = 500.00
  12. MSPF = 1.00 / FPS
  13.  
  14. # define some colors
  15. BLACK = (0, 0, 0, 255)
  16. WHITE = (255, 255, 255, 255)
  17.  
  18. dot_size = 5
  19. dot_x = W - dot_size
  20. del_y = 0
  21.  
  22. exit = False
  23.  
  24. startTime = time.time()
  25. # main loop
  26. while True:
  27.     for event in pygame.event.get():
  28.         if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
  29.             exit = True
  30.     if exit: break
  31.    
  32.    
  33.     my = pygame.mouse.get_pos()[1]
  34.     pygame.draw.line(DS, WHITE, (dot_x, del_y), (dot_x, my), 5) #circle(DS, WHITE, (dot_x, my), dot_size, 0)
  35.     del_y = my
  36.  
  37.     testTime = time.time()
  38.     if testTime - startTime >= MSPF:
  39.         startTime += MSPF
  40.         DS.blit(DS, (0, 0), (1, 0, W - 1, H))
  41.         pygame.display.update()
  42.  
  43. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement