Tuesday, 28 August 2018

Ubunty pygame gets event.key values

The following pygame code stopped working correctly after I upgraded from ubuntu 16.04 to ubuntu 18.04.

for event in pygame.event.get():
    if event.type == pygame.KEYDOWN:
        print "KEY:", event.key
        if event.key == pygame.K_ESCAPE:
            # The code here is executed when "Esc" is pressed.
        elif event.key == pygame.K_f:
            # Never happens even when "f" is pressed.

The code prints "Key: 193" when I press f instead of expected "Key: 102".

Any ideas what can be wrong?

I have several keyboard layouts installed and I am sure that I use "English" when it happens.



from Ubunty pygame gets event.key values

No comments:

Post a Comment