[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Earliest access to state of keyboard?




I'd like to poll the keyboard before opening a window, in order to determine if the game should launch in Window or Fullscreen mode.  This code prints 0:

pygame.event.pump();
print pygame.key.get_mods();

#then open window
pygl2d.window.init(...)


I suspected there had to be a window before the event system works. But this code also prints 0:

    pygame.init();
    pygame.display.set_mode([1024, 768], DOUBLEBUF); #fake window to allow access to keys
    pygame.event.pump();
    print pygame.key.get_mods();

    #now change window to reflect keypress...


suggestions?