On Wed, Dec 03, 2003 at 08:55:10AM +0000, Alessandro Bottoni wrote:
> Most likely you know AutoCAD. Well, I have to write a program like AutoCAD 
Nope I do not know AutoCAD :) Probably most people do not know AutoCAD.
As most people do not know specialized expensive software specific to a niche.

Big question: Are you writing the app in Python or C/C++?

If you are writing it in C/C++, you should consult the 
"Extending and Embedding Python" documentation on http://www.python.org/.

There are a number of tools that might help you, like Swig, Pyrex, and others.

If you are writing it in Python, just use plain PyGtk :)

Andreas
> So, I wonder:
> 
> - How can I embed a Python interpreter into a PyGTK application? Do I have to 
> have a separated process for the embedded interpreter or I have to use the 
> existing PyGTK Python interpreter? (I would like to have a separated process, 
> if I had to choose).
Why would you want to embed a Python interpreter in a PyGTK app? Did you
mean gtk app? Or do you mean "How do I write a python interactive loop" in
Python, so that I can use it together with PyGTK? (Hint: codeop.py)

> 
> - Is there any viable "PyCLIWidget" I can use as the PyGTK CL window for my 
> app?
What's wrong with a multiline entry widget?
> 
> - How can I communicate with my embedded interpreter? Just use its 
> STDIN/STDOUT pseudo-files? Or use IPC, maybe via TCP/IP sockets?
Well, that depends how you structure your app. In an embedded Python
environment you communicate by calling the Python/C API (or by using some
other neat tricks ;) ).

> - How can I make accessible my PyGTK variables/functions/objects to my 
> embedded interpreter? Just load the existing PyGTK modules and call the 
> wished functions? What if the embedded interpreter and the PyGTK engine are 
> separated Python process? How can they share the same environment?
Seperate processes is not trivial as it is not supported by default.
(You can try to write Pyro wrappers ;) )

Depending upon how you embed python, the python interpreter doesn't loose it's
ability to load dynamic modules -> just import the gtk module in your scripts.

Again I've got somehow the impression that you don't understand the function
of PyGTK.
> 
> - How can I keep my embedded interpreter "waiting for commands"? Can I use a 
> text stream as input (I mean: a live STDIN pseudo-file, instead of a static 
> file)? I would like to have something like the mod_python of Apache.
Nope, you just say the interpreter execute "that", and then the python
interpreter is running. And when "that" is finished control returns to
your app.

Just tell us more what you intend to do? (like is your app in C? or in Python?)
Then somebody might be able to help you better ;)

Andreas Kostyrka
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to