building games with pygame alternative approach to processing input devices there are actually two ways in which inputs from device such as mousejoystick or the keyboard can be processed one approach is the event based model described earlier the other approach is the state based approach although the event based approach has many advantages is has two disadvantageseach event represents single action and continuous actions are not explicitly represented thus if the user presses both the key and the key then this will generate two events and it will be up to the program to determine that they have been pressed at the same time it is also up to the program to determine that the user is still pressing key (by noting that no keyup event has occurredboth of these are possible but can be error prone an alternative approach is to use the state based approach in the state based approach the program can directly check the state of input device (such as key or mouse or keyboardfor exampleyou can use pygame key get_pressed(which returns the state of all the keys this can be used to determine if specific key is being pressed at this moment in time for examplepygame key get_pressed()[pygame k_spacecan be used to check to see if the space bar is being pressed this can be used to determine what action to take if you keep checking that the key is pressed then you can keep performing the associated action this can be very useful for continues actions in game such as moving an object etc howeverif the user presses key and then releases it before the program checks the state of the keyboard then that input will be missed pygame modules there are numerous modules provided as part of pygame as well as associated libraries some of the core modules are listed belowpygame display this module is used to control the display window or screen it provides facilities to initialise and shutdown the display module it can be used to initialise window or screen it can also be used to cause window or screen to refresh etc