keyboard controlled character

Hi,
I’ve read the manuals of panda 3d than I found in the web, but I still didn’t understand well about how to control an actor by keyboard.
I’m looking for an easy full script about it 'cause the one in the manuals is just a part and when I tried on my models it doen’t work.
Can u help me?
Thanx!

The only thing what you have to do is to setup an event for every key.
That means if you want that if you hit ‘a’ the model should do something you have to setup an event for ‘a’

class World(DirectObject)
  def __init__(self):
    self.model= ....
    self.setupkeys()
  
  def setupkeys(self):
    self.accept('a',foo)
    self.accept('a-up', foobar) #when a is released
  
  def foo(self):
    dosomething

  def foobar(self):
    ....

w= World()