Entry
Simple xmgrace Python interface
Jul 5th, 2000 10:02
Nathan Wallace, Hans Nowak, Snippet 263, nbecker@fred.net
"""
Packages: interfaces
"""
import popen2
class grace:
def __init__ (self):
self.p = popen2.Popen3 ("xmgrace -noask -dpipe 0")
def Command (self, cmd):
if (cmd[-1] != '\n'):
cmd = cmd + '\n'
self.p.tochild.write (cmd)
def Flush (self):
self.p.tochild.flush()
def Wait (self):
return self.p.wait()
if (__name__ == "__main__"):
g = grace()
g.Command ("g0.s0 point 0,0")
g.Command ("g0.s0 point 1,1")
g.Flush()
print "returned:", g.Wait()