code.InteractiveConsole in a newly created xterm
Michael Hudson
mwh at python.net
Wed Jan 30 05:39:45 EST 2002
Simon Budig <Simon.Budig at unix-ag.org> writes:
> Hi all.
>
> The following works great:
>
> import code
> def python_inter():
> ip = code.InteractiveConsole ()
> ip.interact ("Python interactive Console")
>
> However, I want to have this in a freshly created xterm window and I have
> not been able to figure this out. I guess I somehow have to use
> pseudo terminals and the xterm "-S" option. Something like (pseudocode):
>
> import code,spam
> def python_inter():
> xterm = spam.create_xterm_instance ()
> ic = code.InteractiveConsole ()
> ic.connect_to_xterm (xterm)
> ic.interact ("Python interactive Console")
> xterm.close ()
>
> Is this possible? For as much Unix-like platforms as possible?
Probably. You almost certainly need to write your own version of
InteractiveConsole, or maybe just subclass it and override
raw_input().
I don't have access to X here, so you'll have to fiddle the details
yourself...
Cheers,
M.
PS: you might be able to get pyrepl working on an arbitrary file
descriptor more easily:
http://starship.python.net/crew/mwh/hacks/pyrepl.html
--
ARTHUR: Why should he want to know where his towel is?
FORD: Everybody should know where his towel is.
ARTHUR: I think your head's come undone.
-- The Hitch-Hikers Guide to the Galaxy, Episode 7
More information about the Python-list
mailing list