Guest User

Pygame

a guest
Feb 14th, 2014
54
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. # Blink.py is a PyGame program that makes B-MO's face blink, using simple graphics and images.
  4.  
  5. # Import the PyGame and system files to use
  6. import pygame
  7. import sys
  8. import random   # Importing random allows me to make blinks happen on a random interval
  9.  
  10. from pygame.locals import *
  11.  
  12. # Initilize Pygame and set the clock speed (Set to 30fps)
  13. pygame.init()
  14. FPS = 30
  15. fpsClock = pygame.time.Clock()
  16.  
  17. # Set the display size (should always be 720x480)
  18. DISPLAYSURF = pygame.display.set_mode((720 480))
  19.  
  20. # Set-up the colours that will be used
  21. BLACK   = (  0,   0,   0)
  22. WHITE   = (255, 255, 255)
  23. BMOBLUE = (222, 255, 239)
  24.  
  25. # Load and set any variables for images we have
  26. blinkImg = pygame.image.load('blink.png')
  27.  
  28. # Set the title of the window
  29. pygame.display.set_caption('B-MO Blink!')
  30.  
  31. # Draw the surface objects
  32. DISPLAYSURF.fill(BMOBLUE)
  33. DISPLAYSURF.blit(blinkImg, (32, 32))
  34.  
  35.  
  36. while True:     # Main loop
  37.    
  38. #   for event in pygame.event.get():
  39.         if event.type == QUIT:
  40.             pygame.quit()
  41.             sys.exit()
  42.  
  43.     # Update the display to draw the new things we put in
  44.     pygame.display.update()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×