Keyboard Input

I’m trying to learn the Keyboard input for the fist time and need to know how to properly construct a class which would handle the input.

This example does not work; could someone show me the correct way to write this?

class PheAnimChg:
def init(self):
self.accept(“space”, self.FlippPhe);

    def FlippPhe(self):
        PheANIM = phena.getAnimControl("PheIdle1a");
        if PheANIM.isPlaying():
            phena.stop();
            phena.loop("PheRun1a");
        else:
            PheANIM2 = phena.getAnimControl("PheRun1a");
            if PheANIM2.isPlaying():
                phena.stop();
                phena.loop("PheIdle1a");

OMG! I solved “me” own issue again!

Turns out I was relying too much on the Manual and other peoples’ scripts that involve movement.

I decided to use my own Python Programming Experience and it payed off. I just needed a simple piece of code that did an animation change so I can get a feel for how the code should be constructed in Panda…since Panda is Panda and not any of the other Programs I’ved used in the past.

Thank “gawd”…but I don’t know how long I can keep this up…the solving my own problems. I expected a Panda Pro would easily answer this forum since my issue was a Noob issue.

Anyway…all well ends well. 8)

I was going to post an issue related to LerpFuncs, but I decided to keep at it. Well…I solved it. 8)

And it was like I said…the Manual left out an important piece of info. Once I realized the info that was left out…I was able to figure out how to use the LerpFuncs.

So now…as a Noob, I have loaded a Model, caused it to Animate, change animations, and now change animations smoothly from one to the next (and some others stuff I’ve figured out too). Moving along fast. :wink:

first of all, grats on being a “noob” and being able to learn everything that you have so far. I just have some advice for posting/your code:

  1. try to use the code /code blocks to keep the indentation of your code when posting it
    2)you can find most of the answers to your questions in the manual or the samples. They are pretty easy to understand and well documented
  2. referring to your code above, does python really use “;” after each line? I’m pretty sure that it does not (I can be wrong), that seems like a java (c++?) syntax to me.
  3. could you post if there is a specific error with your code. From your code I can see an undefined error with the var “phena” because it does not appear to be instanced yet.
    5)you cant expect an answer right away to your problems. It was a little after an hour since your first post. It also happens to be a holiday in the States today…so most people from the States will probably not go online to check this. Its also a Monday and during the work day…

final word. Looking at your last post:

it seems like if you looked at the roaming ralph sample that came with panda you would have had most of those concerns addressed.

good luck with panda