Input and Output Redirection with a Terminal?

I’d like to experiment with creating file browsers with Panda3D in Linux (Specifically, Fedora 6), and the first step seems to be getting Panda3D to interface with the terminal it runs from.

For example, I’d like the user to be able to complete an action that would essentially send a “ls” command to the terminal and return the contents of the directory, or another action such as “cd …” that would traverse the directory upward one level.

Essentially, I need to be able to send commands to the terminal, and take the output of the terminal and read it into Panda3D.

I understand Panda3D is generally for high-level coding, so if there is no way to do this using the Panda3D libraries, I would also appreciate suggestions on how to set up this sort of communication between Panda3D and the terminal using some sort of intermediary script or program. Any suggestions, links, tutorials, or simple tips would be more than appreciated!


Also: For simplicity’s sake, I’m concerned firstly with textual input and output, but later I would like to investigate a similar setup with the mouse, redirection input and output between X Window and Panda3D.

For the text exchange with the terminal I think you can do it through the Python function os.popen4.

I guess for more complex things you’d need something like d-bus, and its Python bindings.

Thanks, I’ll look into this! Any other leads on alternative ways to do this are still appreciated!

Also look at the file-searching functions built into Python specifically, like os.listdir() and os.walk().