exposing tkconsole with shell in IDLE/IDLEfork

James Tauber jtauber at jtauber.com
Wed Jun 25 17:25:43 CEST 2003

As a way of achieving my previously mentioned goal of an interactive
Python prompt that can embed non-text in the output window, I made the
following modification in PyShell.ModifiedInterpreter.__init__ in IDLE
(that shipped with 2.2.3)

    def __init__(self, tkconsole):
        self.tkconsole = tkconsole
        locals = sys.modules['__main__'].__dict__

        locals["tkconsole"] = tkconsole

        InteractiveInterpreter.__init__(self, locals=locals)
        self.save_warnings_filters = None

This works great! But trying the same thing in IDLEfork 0.9b1 doesn't
work. "tkconsole" is nowhere to be seen in the shell's locals.

So I have two questions:

  - is this the best way to expose tkconsole to the interactive prompt?
  (to enable python functions to output graphics, etc embedded in the
  output window)
  - what would I need to do to get this to work with IDLEfork?


  James Tauber

More information about the Python-list mailing list