GUI programming, embedding, real time plots, etc.

Madhusudan Singh spammers-go-here at spam.invalid
Sat Aug 6 00:28:34 EDT 2005


nephish at xit.net wrote:

> apt-get install python-pwm
> this will get you python mega widgets
> one of the dependencies that apt will take care of for you is the
> python2.whatever-tk.
> depending on which version of debian you are using.
> i run sarge with python 2.3

Thanks for the help.

I tried to write a piece of code to plot some simulated data from a
measurement :

from Tkinter import *
import Pmw

steps=(0,)
voltages=(0,)

master=Tk()
plot=Pmw.Blt.Graph(master)
plot.pack(expand=1,fill='both')

for i in range(1,10):
    steps=steps+(i,)
    setvolt=1.0*i/100
    voltages=voltages+(setvolt,)
    plot.line_create("Plot",xdata=steps,ydata=voltages)


master.mainloop()

This quits with :

Traceback (most recent call last):
  File "<stdin>", line 15, in ?
  File "/usr/lib/python2.3/site-packages/Pmw/Pmw_1_2/lib/PmwBlt.py", line
266, in line_create
    self.tk.call((self._w, 'line', 'create', name) + self._options(kw))
_tkinter.TclError: element "Plot" already exists in ".-1222950836"

Now, if I try to plot from outside the loop (move the last statement in the
loop out of it), it plots ok. I need to plot this in realtime. So, what
would be the best approach ?



More information about the Python-list mailing list