Embedding a python console inside a python application

Zorigaman zorigaman at gmail.com
Mon Aug 17 14:46:21 EDT 2009


Hi,

I am starting an application in which I would like to have some
scripting functionality. It will obviously be done in Python. The
thing is that I would like my scripts to have access to the rest of
the application as an object it could manipulate.
I made some research and I found the code module, which allows to have
a Python interpreter inside an application, but I am not sure if I can
access to the "parent" which created this interpreter. A solution
could be to launch my application through an interpreter, but the
problem there is how to integrate it back into the GUI, redirecting
streams ?
Another option is the cmd module, but here, same problem, I am not
sure if can have access to my application's objects.
I am using PyQt with Python 2.6.1, I could switch to Python 3.0 if
necessary.
I am familiar with programming, but that's my first script-enabled
application, tell me if I am missing something obvious.

http://docs.python.org/library/code.html
http://docs.python.org/library/cmd.html



More information about the Python-list mailing list