PDA

View Full Version : [SOLVED] [python] Redirect stdin stderr and stdout to wxPython text box



Crazedpsyc
April 3rd, 2011, 11:01 PM
Hello, I would like to make a very very tiny terminal application in wxPython to use with the shell I am making.
I know I can set sys.stdout to a custom class and have the write method go to a textbox, but that doesn't work with readline, because it apparently requires several other methods. I also don't know how to redirect stdin to a line in a textbox at all. I assume stderr should be about the same as stdout, but I'm not sure.
If there is another wxpython widget that would act more terminal-like, I would be happy to use it, but I'm not sure about using PyGTK for anything.
If you know of an existing wxpython app that has these functions, looking at it would help too.

Thanks!

cgroza
April 3rd, 2011, 11:15 PM
Hmm, there is already a library out there for that: http://sourceforge.net/projects/termemulator/

It includes a demo, maybe that will put you on the wheels.

Crazedpsyc
April 4th, 2011, 05:58 PM
Thanks, I'll take a look!

Crazedpsyc
April 5th, 2011, 03:28 PM
That is exactly what I wanted, thanks!