panda3d from command line?

If I import the Panda3d modules from the Python command line, I can’t type anything as soon as I use run() to render the window. Can I have Panda3d render the frames but still be able to write code in the command line and see the changes immediately? Without having to restart the program each time?

You shouldn’t call run() if you want to still be able to type commands in a python console. Just import directStart, and to render frames you can use :

base.graphicsEngine.renderFrame()

Check the Graphics Engine section of the manual for details about that.

Okay. Why is the page not in the table of contents, btw?

That page is out-of-date and was never terribly accurate in the first place. It’s been removed from the manual.

Actually, it’s usually better to call taskMgr.step() to step to the next frame, since that also invokes all of the tasks for a single frame (in addition to simply drawing the current frame).

But a better way to use Python interactively is to invoke it with the -i flag, e.g. “python -i myfile.py”. Then you can call run() to start running at normal speed anytime you like, and use control-C to break back into the prompt.

David

I was very interested in this topic, and i managed to run panda with ipython interactively on linux (mint).
On windows it seems like it wont work at all…

With this you don’t need to ctrl-c to get cmd prompt, but there are alos performance problems that i dont understand…
c/p braces too
wiki.ipython.org/Cookbook/Integr … 3d_example

Alternative is to use “exec” in python.
You could use any gui library and open second window, put input box inside, and when you submit you exec whatever was typed in.

This works great if you store all your world data in one object, and just pass that object to function which calls exec.

You could also make in-game console, and use raw python commands from it, essentially its same thing.