469,631 Members | 1,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

GUI programming, embedding, real time plots, etc.

Hi

I am still a rookie at python (can do some basic programming with the
language), and have been using python gpib and matplotlib to control my
instruments and do real time plots. Since I have more than one instrument
to control, I was thinking of writing a GUI using Tkinter (looked at Page,
but it not have a debian package and I saw quite a few bugs listed -
Tkinter seems mature). I have some questions :

1. In using matplotlib (my code essentially involved creating a plot and
show()'ing it inside a loop), the color of the plot changed. Is there a way
to tell matplotlib to not treat each new invocation as a new plot, but to
really overwrite the old one ?

2. Is it possible to embed the matplotlib o/p in the o/p GUI ?

3. Are there some other caveats that I should be aware of in using
matplotlib ?
Aug 6 '05 #1
3 3025
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

Aug 6 '05 #2
ne*****@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 ?
Aug 6 '05 #3
In article <42***********************@news.sunsite.dk>,
Madhusudan Singh <sp**************@spam.invalid> wrote:
1. In using matplotlib (my code essentially involved creating a plot and
show()'ing it inside a loop), the color of the plot changed. Is there a way
to tell matplotlib to not treat each new invocation as a new plot, but to
really overwrite the old one ?


You were able to get matplotlib to open a new plot each time (assuming
you closed the old one, too)? Can you show a simple example of this?

Thanks.

-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Aug 8 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gerrit Holl | last post: by
23 posts views Thread by Robey Holderith | last post: by
22 posts views Thread by MJR | last post: by
2 posts views Thread by dr_tyson | last post: by
38 posts views Thread by ifti_crazy | last post: by
6 posts views Thread by mistabean | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.