Embedding a python console inside a python application

Zorigaman zorigaman at gmail.com
Tue Aug 18 00:26:23 CEST 2009


On 17 août, 20:46, Zorigaman <zoriga... at gmail.com> wrote:
> 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.htmlhttp://docs.python.org/library/cmd.html

D'oh. The code module offers exactly what I need, you can specify
object in the interpreter's constructor. D'oh.



More information about the Python-list mailing list