473,394 Members | 1,866 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,394 software developers and data experts.

Inter-Process comunication


Hi

I'm writting a program to get data from a machine. I'm using wxPython
to build the GUI. I've a mehtod in a class that get the data,
something like this:

data = []
def Measure(self):
do somehting...
while ...
point = getdatapoint()
data.aapend(point)
do something...

I want to plot the data in a "canvas", but i want to replot each time
a point is added to data. I don't watn to insert the code to plotting
inside the Measure (becose this code is GUI dependent). The code for
plotting is in another function DrawPlOt()

I want something like to send a signal each time the data is changed
to execute DrawPlot(). I'm no proffesional programmer and i don't know
wich technique is the best, signals, theread, anothero one ...
Any sugestions?

TIA

Zunbeltz Izaola
--
Remove XXX from email: zu******@wm.lc.ehu.esXXX
Jul 18 '05 #1
3 2903
Zunbeltz Izaola wrote:
I want something like to send a signal each time the data is changed
to execute DrawPlot(). I'm no proffesional programmer and i don't know
wich technique is the best, signals, theread, anothero one ...
Any sugestions?


Have a look at Pyro, http://pyro.sourceforge.net
You could stick your DrawPlot() method in a Pyro object
and call it -remotely- from the process/thread that
generated new data to plot.

--Irmen

Jul 18 '05 #2
In article <3f***********************@news.xs4all.nl>,
Irmen de Jong <irmen@-NOSPAM-REMOVETHIS-xs4all.nl> wrote:
Zunbeltz Izaola wrote:
I want something like to send a signal each time the data is changed
to execute DrawPlot(). I'm no proffesional programmer and i don't know
wich technique is the best, signals, theread, anothero one ...
Any sugestions?


Have a look at Pyro, http://pyro.sourceforge.net
You could stick your DrawPlot() method in a Pyro object
and call it -remotely- from the process/thread that
generated new data to plot.

Jul 18 '05 #3
Zunbeltz Izaola <zu******@wm.lc.ehu.es.XXX> wrote in message news:<m1************@lcpxdf.wm.lc.ehu.es>...
I want to plot the data in a "canvas", but i want to replot each time
a point is added to data. I don't watn to insert the code to plotting
inside the Measure (becose this code is GUI dependent). The code for
plotting is in another function DrawPlOt()

I want something like to send a signal each time the data is changed
to execute DrawPlot(). I'm no proffesional programmer and i don't know
wich technique is the best, signals, theread, anothero one ...
Any sugestions?


First do you want your data collecting class running as a separate
thread in your wxPython app (simplest way), or as a completely
separate process/application that communicates remotely with your
wxPython app?
To do it using threads, see:
http://wiki.wxpython.org/index.cgi/LongRunningTasks
If it is running as a separate application, then you would need to use
something like sockets/Pyro/Twisted to communicate with your wxPython
app.

Second, if you are just plotting the data, see something like wxPyPlot
or SciPy's wxPython plotting options.
http://scipy.com/
http://www.cyberus.ca/~g_will/wxPython/wxpyplot.html

Next, see the Observer-Observable and Model-View-Controller patterns.
Bruce Eckel has an example of observer and observable in Python:
http://jamesthornton.com/eckel/TIPython/code/util/

Make your data collecting class (the Model) a subclass of Observable.
When it gets new data, it calls its own "notifyObservers" method, and
optionally passes the data value (with or without a time stamp too) as
an argument.

Your wxPython canvas (the View) subclasses Observer, and implements a
"notify" method to receive the new data and draw it. But don't redraw
it immediately if the Model is running in a separate thread, use
something like wxCallAfter(self.RedrawPlot) so that all drawing
happens in the main wxPython application thread (or if you are using
SciPy, see its gui_thread module).

One other problem - if your model is continuously collecting a lot of
data very fast, then your wxPython app will get bogged down if you
redraw every time new data is received. What I do is have the
"notify" method just append the time stamped data to an array (see the
Numeric module). Then I use a wxTimer to draw the new data at regular
intervals.
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David M. Karr | last post by:
I've been asked to help debug a complex problem involving inter-frame references, so I just want to understand the elements involved with this. Apparently, there is a page with multiple frames,...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
6
by: les | last post by:
Here's a class which uses 2.0 generics to implement an inter-thread message queue in C#. Any number of threads can post and read from the queue simultaneously, and the message object can be any...
5
by: Joseph Geretz | last post by:
I need to communicate between two applications. The legacy application is in VB6. New development is in C#. Here's the scenario: The VB6 app will be pumping document files into a folder. We'll be...
7
by: Sumedh | last post by:
Hi everyone There is a C# project which calls C++/CLI dll to be able to call native C++ including templates. But the C++/CLI code itself also requires the C# dll to get the types. For example: ...
1
by: Laurence | last post by:
Hi folks, As I konw: database partition (aka data partition?), the database can span multiple machines; table partition, the data within a table can seperate by certain condition. How about...
1
by: halekio | last post by:
Hi all, Please bear with me as I've only started programming in C# 2 weeks ago and this is my first contact with OOP. I ran into a situation where I needed to catch an event in an object that...
0
by: rkprasad | last post by:
I am able to create BASIC-CLEAR-INTEGRATED sql http endpoint and consume it on a LAN. But i am not able to consume the created endpoint on inter domain network. If i create endpoint on a server...
1
by: rsennat | last post by:
Hi, what is the order of the libraries in the Makefile, for linking inter dependent libraries. i'm getting linker error for the following scenario. I have lib1.a and lib2.a, with which lib1.a...
4
by: Mark | last post by:
Hi, I'm relatively new to Java, but have been a programmer for decades. I would like multiple instances of my Java app (on different computers on the same local LAN) to communicate with each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.