pmw.blt graph question

Karin Lagesen karin.lagesen at labmed.uio.no
Thu Nov 20 04:04:37 EST 2003


I have a gui with a graph area built with Pmw and Pmw.Blt. Through this 
gui I calculate some values that I would like to display in the graph
area. Now, this worked fine when I made the graph in the main gui-building
process and just changed the Pmw.Blt.Vectors that I had used to make
the graph with when I pressed 'compute' and thus activated the compute
method.

However, now I would like to just add graphs to the graph area. I.e.
every time I run the compute method I would like to make a new graph
and have it displayed with the existing ones in the graph area. 
This means having all the graph making stuff in the compute method. 
However, now the graph isn't being displayed. I do know it is somehow
being connected with the graph area, since it is added to the legend
area. I tried doing a self.master.update() (where master is a Tk()
object), this resulted in the graph briefly being flashed across the
area before it vanished again.

Here is the code I use to create the graphs:

	    self.nographs += 1
	    name = 'g' + str(self.nographs)     
	    simfile = os.path.join(self.p['case'].get(), 'sim.dat')
	    simdata = open(simfile, 'r')
	    numarray = filetable.read(simdata)
            Xvect = Pmw.Blt.Vector()
	    x_data = tuple([dat[0] for dat in numarray])
	    Xvect.set(x_data)
	    Yvect = Pmw.Blt.Vector()
            y_data = tuple([dat[1] for dat in numarray])
	    Yvect.set(y_data)
	    self.graph.line_create(name, xdata=Xvect, ydata=Yvect,
				   symbol='')

Anybody got any ideas?

TIA, 

Karin
-- 
Karin Lagesen,
karin.lagesen at labmed.uio.no




More information about the Python-list mailing list