Alle 08:52, mercoled� 3 dicembre 2003, Andreas Kostyrka ha scritto:
> Big question: Are you writing the app in Python or C/C++?
> If you are writing it in Python, just use plain PyGtk :)

I'm using Python.

> 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)

Second one: I want to have a "live" Python interpreter available for 
evaluating expressions/statements supplied by the user. It can be either the 
Python interpreter used by PyGTK or a separated one.

> What's wrong with a multiline entry widget?

Nothing! I just wonder if there is a tool more specific to this task. I have 
seen there is a terminal widget (zvt) in GTK, so I wonder if someone has 
developer a specific "Command Line Window Widget" for applications like the 
one I'm working on.

> > - 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 ;) ).

Thanks. I have seen eval() and excec() as well. Given that my program is a 
Python->Python app, maybe I can just use these two functions (no C code is 
involved).

> Seperate processes is not trivial as it is not supported by default.
> (You can try to write Pyro wrappers ;) )

Ouch!

> 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.

Nice! I'll use it.

> Again I've got somehow the impression that you don't understand the
> function of PyGTK.

Quite possible. I'm still thinking about this app and I'm still trying to 
figure out where a thing stops and where starts the following one.

> 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.

Perfect! I was making things much more complicated than what was actually 
required.

> 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 ;)

My app is pure Python (maybe C or C++ libraries added in future for 
performance improvement). It should be a graphic (vector-based) editor and I 
need to have a "command line interface". This interface must be available 
both for running scripts and for running expressions and statements supplied 
by the user at run time.

Thanks for your help, Andreas.
----------------------------------
Alessandro Bottoni
[EMAIL PROTECTED]
_______________________________________________
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