[Idle-dev] Using parts of IDLE?

Douglas S. Blank dblank at brynmawr.edu
Wed Sep 22 08:19:05 CEST 2004


Hello,

I'm new to this list and idle, so please point me in the right direction if
there are docs, examples, or if I'm in the wrong place.

I'd like to use parts of IDLE (say, the editor, the debugger, and the class
and path browsers) from another Python Tk GUI. For example, I'd like to open
up the idle editor if the user clicks on a filename in my GUI.

It appears that IDLE likes to be the main GUI, but I have gotten this to work
somewhat, by faking some bits:

import Tkinter
gui = Tkinter.Tk() # or something more complicated
import idlelib.PyShell as PyShell
from idlelib.FileList import FileList
PyShell.flist = FileList(gui)
# ... start up gui

and somewhere else, triggered, perhaps, by a user's click:

import idlelib.PyShell as PyShell
PyShell.flist.open(file)

Ok, so that sort of works, but there are problems, and doesn't seem very
clean. Problems:

1. You can't actually edit files; error: 'module' has no attribute 'ps1'
2. If you close the idle file edit window, it closes the main gui
3. The path and path browsers do work (because of my hack of putting flist in
PyShell module namespace)

Big questions:

Can you run the idle editor without the pyshell? Is there going to be a way to
actually use the debugger from inside another gui? What is the best way to
combine IDLE with another main GUI window?

Thanks in advance for any pointers!

-Doug

-- 
Douglas S. Blank,       Assistant Professor         
dblank at brynmawr.edu,          (610)526-6501
Bryn Mawr College,  Computer Science Program
101 North Merion Ave,  Park Science Building
Bryn Mawr, PA 19010 dangermouse.brynmawr.edu





More information about the IDLE-dev mailing list