SFML community forums

Help => General => Topic started by: sebastiend on March 18, 2008, 01:06:02 pm

Title: Key code problem
Post by: sebastiend on March 18, 2008, 01:06:02 pm
I encounter something strange:

Code: [Select]
from PySFML import *
     
if __name__ == "__main__":
    global window
    window = sf.RenderWindow(sf.VideoMode(800, 600, 32), "SFML Window")
    global running
    running = True
    while running == True:
        evt = sf.Event()
        while window.GetEvent(evt):
            if evt.Type == sf.Event.Closed:
                running = False
            if evt.Type == sf.Event.KeyPressed:
                print evt.Key.Code
        window.Display()

This display 51 each time I press a key indepently of the real code.
Could it come from my compilation or system as I use a 64 bits Fedora?
Title: Re: Key code problem
Post by: remi.k2620 on April 20, 2008, 02:05:11 am
Quote from: "sebastiend"
I encounter something strange:

Code: [Select]
from PySFML import *
     
if __name__ == "__main__":
    global window
    window = sf.RenderWindow(sf.VideoMode(800, 600, 32), "SFML Window")
    global running
    running = True
    while running == True:
        evt = sf.Event()
        while window.GetEvent(evt):
            if evt.Type == sf.Event.Closed:
                running = False
            if evt.Type == sf.Event.KeyPressed:
                print evt.Key.Code
        window.Display()

This display 51 each time I press a key indepently of the real code.
Could it come from my compilation or system as I use a 64 bits Fedora?


Strange, what version of PySFML are you running (1.2 or svn)?
(Sorry I'm a month late, but you should add [PySFML] in front of the subject when it has something to do with PySFML, so i can quickly spot it.)