[Idle-dev] PyShell Question

Dean N. Williams williams13 at llnl.gov
Tue Sep 16 10:34:39 EDT 2003


Dear IDLE Developers,

    I have a simple example of what I'm trying to do. In this example, 
the Tk window will appear followed by a IDLE Pyhton Shell window. What I 
would like to do is Close or Exit the Python Shell window WITHOUT 
closing or exiting the Tk window. On the other hand, if I Close or Exit 
the Tk window, then I want to close the Python Shell Window.

    I noticed that if I run the script with the  -i  option (i.e., 
"python -i pyshell_test.py"), then it works like I expect it to work. 
But if I run the script without the -i option, it doesn't work.

    How can I get this to work without running python with the -i option?

    Thanks in advance for any help.

Best regards,
    Dean


-----------------
import Tkinter

from idlelib import PyShell

root = Tkinter.Tk()

#########################
PyShellEditorWindow=PyShell.PyShellEditorWindow
PyShellFileList=PyShell.PyShellFileList

root.flist = PyShellFileList( root )

#########################
PyShell.use_subprocess = False
PyShell.enable_shell = False
shell = PyShell.PyShell(root.flist)

#########################
root.mainloop()


-------------- next part --------------
import Tkinter

from idlelib import PyShell

root = Tkinter.Tk()

#########################
PyShellEditorWindow=PyShell.PyShellEditorWindow
PyShellFileList=PyShell.PyShellFileList

root.flist = PyShellFileList( root )

#########################
PyShell.use_subprocess = False
PyShell.enable_shell = False
shell = PyShell.PyShell(root.flist)

#########################
root.mainloop()



More information about the IDLE-dev mailing list