Constants of a Pygame.
locals
Learning Outcomes:
a. Understand pygame.locals
b. Familiarize the different pygame.locals
Pygame.locals –it is a module that contain constants that is used and defined by pygame.
Detailed descriptions of the various constants can be found throughout the pygame documentation. Here
are the locations of some of them.
1. The pygame.display - pygame module to control the display window and screen
pygame.display.init Initialize the display module
pygame.display.quit Uninitialize the display module
pygame.display.set_mode FULLSCREEN - create a fullscreen display
DOUBLEBUF - only applicable with OPENGL
HWSURFACE - (obsolete in pygame 2) hardware
accelerated, only in FULLSCREEN
OPENGL - create an OpenGL-renderable display
RESIZABLE - display window should be sizeable
NOFRAME - display window will have no border or
controls
SCALED - resolution depends on desktop size and
scale graphics
SHOWN - window is opened in visible mode
(default)
HIDDEN - window is opened in hidden mode
pygame.display.flip Update the full display Surface to the screen
pygame.display.update(x,y,w,h) Update portions of the screen for software displays
pygame.display.get_window_size Return the size of the window or screen
2.The pygame.event - pygame module for interacting with events and queues module contains the
various event types.
pygame.event.get get events from the queue
pygame.event.wait wait for a single event from the queue
pygame.event.peek test if event types are waiting on the queue
pygame.event.clear remove all events from the queue
3. The pygame.key - pygame module to work with the keyboard module lists the keyboard constants
and modifiers (K_* and MOD_*) relating to the key and mod attributes of
the KEYDOWN and KEYUP events.
4. The pygame.time - pygame module for monitoring time module defines TIMER_RESOLUTION.
pygame.time.get_ticks get the time in milliseconds
pygame.time.wait pause the program for an amount of time
pygame.time.delay pause the program for an amount of time
pygame.time.set_timer repeatedly create an event on the event queue
pygame.time.Clock create an object to help track time