event.type pygame code example
Example 1: check key pressed pygame
import pygame
events = pygame.event.get()
for event in events:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
location -= 1
if event.key == pygame.K_RIGHT:
location += 1
Example 2: how to pring events in pygame
import pygame
pygame.init()
screen = pygame.display.set_mode((500,300))
thing = 0
while thing < 100000000:
thing += 1
event = pygame.event.get()
print (event)
pygame.quit()