Embedding a python console inside a python application

Discussion in 'Python' started by Zorigaman, Aug 17, 2009.

  1. Zorigaman

    Zorigaman Guest

    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
    Zorigaman, Aug 17, 2009
    #1
    1. Advertising

  2. Zorigaman

    Zorigaman Guest

    On 17 août, 20:46, Zorigaman <> 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.
    Zorigaman, Aug 17, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Finney
    Replies:
    2
    Views:
    987
    Egor Bolonev
    Jun 30, 2003
  2. Egor Bolonev
    Replies:
    0
    Views:
    477
    Egor Bolonev
    Jun 30, 2003
  3. Serge Terekhoff
    Replies:
    0
    Views:
    642
    Serge Terekhoff
    Jun 30, 2003
  4. Paul Miller

    embedding an interactive console

    Paul Miller, Apr 28, 2005, in forum: Python
    Replies:
    1
    Views:
    430
    Paul Miller
    Apr 28, 2005
  5. Janto Dreijer

    embedding console in wxpython app

    Janto Dreijer, Aug 6, 2006, in forum: Python
    Replies:
    2
    Views:
    595
    placid
    Aug 7, 2006
Loading...

Share This Page