Hi Yang,
I'm not sure to undestand well you question (feel free to correct me).
There are two possibilities: the former is use Py_Shell to load your
program, but this way can be really difficult especially if the program
you load is a gui (with gui I mean something that call the
gtk.main_loop) because the second call to main_loop will freeze the
Py_Shell interface; a lot of work should be done to avoid possible
deadlock etc., and this is a bit out of scope for Py_Shell.
The latter way is create your gui which embed Py_Shell and pass to the
shell a local dictionary. I'm going to explain last sentence (that's not
clear also to me :-))
Py_Shell is based on InteractiveConsole (IC) (InteractiveConsole and
InteractiveInterpreter are located into the code module, you can see the
python doc for more infos). When you create an IC object you can pass it
a dictionary; every command send to the IC will be executed into the
environment based on that dictionary so this is probably what you are
looking for .
So try somethings like this: in Py_Shell change the line where it's
created the InteractiveConsole (around line 287)
self.core=code.InteractiveConsole()
and replace with
self.core=code.InteractiveConsole(locals())
Hope this helps
Best regards!
Pier
Il mar, 2003-11-04 alle 23:55, Yang Zheng ha scritto:
> Hello Pier,
>
> That fixed my problem, thanks a lot for your program and help!
>
> I know this is going to be a bit out of scope of the GUI, but I was
> wondering if it's possible for this Py_Shell to be the original shell
> that is used to load up the gui in the first place. Say I have this
> Gui.py that loads up functions, variables, and the glade stuff. When I
> run it, the gui pops out, with your Py_Shell embedded inside.
> Currently, the Py_Shell inside the gui is a completely new one that has
> no knowlege of the Gui.py functions/variables. Is there a way for
> Py_Shell to have acess to them?
>
> thanks again,
> ~ Yang
>
>
> On Tue, 2003-11-04 at 11:46, Pier Carteri wrote:
> > Hi Yang!
> > main_shell=Py_Shell.Shell_Gui(with_window=0)
> > > xml.get_widget("vpaned1").add2(main_shell.gui)
> >
> > I've looked to my code, I think the solution is that you miss a
> > main_shell.gui.show_all()
> > In my code I call it with the empty frame, that's why you see only the
> > frame.
> > You ca fix it:
> > put line 313 " frame.show_all()" after line 314 "frame.add(box)"
> >
> > > >>> import pygtk
> > > >>> pygtk.require('2.0')
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in ?
> > > File "pygtk.py", line 73, in require
> > > assert versions.has_key(version), \
> > > AssertionError: required version '2.0' not found on system
> >
> > It seems that somethings is wrong with your configuration; are you sure
> > you have installed pygtk into the right location? The script doesn't
> > find the required version of pygtk
> >
> > Hope this help!
> >
> > Best regards!
> >
> > Pier
> >
> > _______________________________________________
> > pygtk mailing list [EMAIL PROTECTED]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
> _______________________________________________
> pygtk mailing list [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
--
Pier Carteri <[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/