Embedding a python console inside a python application

Z

Zorigaman

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
 
Z

Zorigaman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top