open second xterm under X11

Jason Orendorff jason at jorendorff.com
Sat Dec 15 06:43:08 CET 2001


> How can I open and use a second 
> xterm or text window from within a python program.
> Tcl/Tk seems to be overkill and curses too primitive.

Hmmm.  Try putting this as the first line of your Python script:

#!/bin/env xterm -e /bin/env python

(If this doesn't work at all, it's because I lack the right
environment to test it just now... apologies in advance.)

I don't know if that's what you want though.

If you actually want several xterms under the control of a single
Python program, the easiest thing will be to have several Python
processes talking to one another via sockets.  A Python program
can launch another Python process in a new xterm by calling
os.spawnv() or os.fork() + os.execv(), using the command shown above.

-- 
Jason Orendorff    http://www.jorendorff.com/





More information about the Python-list mailing list