"<key>-down" doesn't works: event problem

I need to use the -down event, but its like if it didn’t existed. It happens nothing when I use it. and -up works, but -down doesn’t. I am new to Panda3D, but I know some python.

Regards in advance,
Daniel

There is no -down event, because the event is the key-down event.

So when the user presses the s key, the event “s” is sent. When the user releases the key, the “s-up” event is sent. I should mention that the “s” event is also sent on key repeat, because it looks like a new down event. If you need only the first down, and not any repeats, you could do this:


self.acceptOnce(<key>, <func>)
self.accept(<key>-up, self.acceptOnce, [<key>, <func>])

That will accept a event, but not again until the -up event re-accepts it, but try just accepting the down first. If you write your code right the key-repeat may not be a problem.

Finally, you can see every message being sent in the game by doing


messenger.toggleVerbose()

I thought there were a -down event because of this:
http://www.panda3d.org/manual/index.php/Keyboard_Support

Thx a lot!! That really helped me.[/img]

Manual repaired. :slight_smile:

Just a doubt:

self.acceptOnce(w, self.walk)
self.accept(w-up, self.acceptOnce, [w, self.stop_walk])

is that correct? Where do I put the function that the event w-up will call?

Dont worry, i discovered.