[Idle-dev] PyShell Question

Dean N. Williams williams13 at llnl.gov
Tue Sep 16 09:12:31 EDT 2003


Dear IDLE Developers,

    I am calling IDLE directly from within my GUI application. In the 
past, (i.e., Python 2.2), I imported the idlelib and imported PyShell 
directly into my GUI application. This gave me greater control, which I 
need for my application.  To do this I had to call PyShellFileList to 
create a flist, then I put in a dummy place holders for flist to tell 
IDLE that my application was the parent (i.e.,Toplevel), so that when I 
close the IDLE window my entire application did not close along with IDLE.
   
    For example:

from idlelib import PyShell

root.flist = PyShell.PyShellFileList( root )
root.flist.dict['vcdat: place holder for idle'] = root
root.flist.inversedict[root] = 'vcdat: place holder for idle'
root.flist.pyshell = None
....

shell = PyShell.PyShell(parent.flist)
shell.shell_title = "VCDAT's Command Line Window"
...

Where root is my Tkinter.Tk()

-----------------------------------------------------------------------------------------------
    Now with the new IDLE this is slightly different. It appears that I 
need to set use_subprocess to false
(i.e., PyShell.use_subprocess = False). It also appears that I do not 
need to set the flist's dict or inverse.
I got everything to work as before, but I cannot get IDLE to think that 
my GUI is the parent.

The question is how do I tell IDLE that my GUI is the parent (i.e., 
TopLevel), so that when I close IDLE, it doesn't close my GUI too?

Thanks in advance for any help....

Best regards,
    Dean




More information about the IDLE-dev mailing list