473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 3227
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gerrit Holl | last post by:
Hi, I have a dictionairy containing DateTime objects as keys and integers as values. What would be the easiest way to create a simple plot of these, with a number axis versus a time axis? What...
23
by: Robey Holderith | last post by:
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to...
22
by: MJR | last post by:
Hi, just wondering what options I would have if I wanted to use Python to produce real-time graphs. Is there any plotting package suitable for this. Thanks, Mike
18
by: Ken | last post by:
Hi. Can anyone refer me to any articles about the compatibility between c++ polymorphism and real-time programming? I'm currently on a real-time c++ project, and we're having a discussion...
2
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code...
38
by: ifti_crazy | last post by:
I am VB6 programmer and wants to start new programming language but i am unable to deciced. i have read about Python, Ruby and Visual C++. but i want to go through with GUI based programming...
6
by: mistabean | last post by:
Hello, first of all, I am a programming newbie, especially in python... Onwards to the problem, I have been having difficulty embedding a python module into my C/C++ program. (just a test...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.