daily pastebin goal
7%
SHARE
TWEET

Pygame Preloader [Simple]

a guest Feb 13th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try:
  2.     import pygame, time
  3.     from pygame.locals import *
  4.     pygame.init()
  5.  
  6.     a = 1.0
  7.  
  8.     #Colors
  9.     BLACK = ( 0, 0, 0)
  10.     WHITE = (255, 255, 255)
  11.     GREEN = (0, 255, 0)
  12.     RED = ( 255, 0, 0)
  13.  
  14.     #screen
  15.     size = (700, 500)
  16.     screen = pygame.display.set_mode(size)
  17.  
  18.     #screen background color
  19.     screen.fill(WHITE)
  20.     pygame.display.update()
  21.  
  22.     #Font
  23.     myfont = pygame.font.SysFont('Anton', 30)
  24.  
  25.     for i in range(100):
  26.         screen.fill((255, 255, 255))
  27.         textsurface = myfont.render(str(a) + ' %', False, BLACK)
  28.         screen.blit(textsurface,(320,210))
  29.         pygame.display.update()
  30.         a = a + 1
  31.         time.sleep(0.05)
  32. except:
  33.     print('===> A problem Occurred <===')
  34.     print('===> Exiting <===')
RAW Paste Data
Top