Posts tagged: pygame

All posts with the tag "pygame"

0 posts
pygame events are stored in a queue, by default the most suggested way shown in all tutorials “pumps” the queue, which removes all the messages. start up pygame # [1] You don’t necessarily need a full boilerplate [2] to start looking at events, you just just need to pygame.init() and to capture any keystrokes you need a window to capture them on, so you will need a display running. import pygame pygame.init() pygame.display.set_mode((854, 480)) get some events # [3] Let’s use pygames normal event.get method to get events. events = pygame.event.get() printing the events reveal this [ <Event(1541-JoyDeviceAdded {'device_index': 0, 'guid': '030000005e0400008e02000010010000'})>, <Event(4352-AudioDeviceAdded {'which': 0, 'iscapture': 0})>, <Event(4352-AudioDeviceAdded {'which': 1, 'iscapture': 0})>, <Event(4352-AudioDeviceAdded {'which': 2, 'iscapture': 0})>, <Event(4352-AudioDeviceAdded {'which': 0, 'iscapture': 1})>, <Event(4352-AudioDeviceAdded {'which': 1, 'iscapture': 1})>, <Event(32774-WindowShown {'window': None})>, <Event(32777-WindowMoved {'x': 535, 'y': 302, 'window': None})>, <Event(32770-VideoExpose {})>, <Event(32776-WindowExposed {'window': None})>, <Ev...