Interactive interpreter in embedded Python

Philip Swartzleonard starx at pacbell.net
Sat May 4 22:20:18 EDT 2002


Bjarke Dahl Ebert || Sat 04 May 2002 06:05:47a:

> Hello,
> 
> When you write a Python extension in C(++), it is very easy to play
> with it from the shell. Just open an interactive interpreter and
> import the extension module.
> 
> But what if you have an application embedding a Python interpreter?
> Then it would also be nice, at least during development, to be able to
> get a "Python prompt" to play with functions exported from the
> application, etc. 
> 
> So, after calling Py_Initialize and initializing my Python extensions,
> what is the easiest way to open a Python Shell in a window?
> I'm programming in Win32. Either IDLE or PythonWin would be fine.
> 
> If the C application is (natively) graphical, will I get problems with
> IDLE/PythonWin interfering with the message handling loop of the
> application?

Library reference section 16.5 is about idle, but i don't know if that 
will do you any good. You might have to build your own interperter 
window; the backend for doing this is in 3.22 (code, intrperter 
objects). I'd suggest looking at the IDLE sources, or pyCrust (wxpython 
interperter window thing designed for imbedding), and seeing if you can 
rip something useful =)

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list