python - How to properly use pygame.event -


for every simple program write using pygame, pygame.event.get() empty, if use keyboard or mouse.

what reason?

for example, code:

import pygame pygame.init() while true:     pygame.event.get() 

yields following output:

[] [] ... [] [] 

i quote pygame's docs:

pygame handles event messaging through event queue. routines in module manage event queue. the input queue heavily dependent on pygame display module. if display has not been initialized , video mode not set, event queue not work.

so @user3557327 states above correct.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -