473,748 Members | 9,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(poi nt)
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 2926
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************ ***********@new s.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 "notifyObserver s" 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(sel f.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
1823
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, where one of the frames is a "hidden" frame, and is there just to contain one or more "fields" that are referenced from other frames. Supposedly, if a user "sits" somewhere in this set of pages for several minutes and then tries to do...
13
4150
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 sense to punch out from managed code to native code (I was using IJW) in order to do some amount of floating point work and, if so, what that certain amount of floating point work was approximately. To attempt to do this I made a program that...
6
16717
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 type. There's a test driver at the bottom which demonstrates usage. /*-----------------------------------------------------------------------------------------------------*/ using System; using System.Collections.Generic;
5
4131
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 writing a new (C#) class for this new feature. The C# Application (as distinct from the file pumper class just mentioned) needs notification for each file pumped into the folder in order to process the file.
7
4594
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: C#: class Test1 {
1
4966
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 inter-partition and intra-partition? Is inter-partition database partition...?
1
4160
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 had no connection or reference to the object that triggered it. It goes something like this: (not syntactically correct..it's just for the idea)
0
1489
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 having live IP and try to access it as http://59.165.20.29/SqlHttpEndPointPath?WSDL from a LAN which has its own proxy then I am not able to access it ; and get HTTP 500/HTTP 501 error in the browser. In a different way i create an sql http endpoint...
1
2213
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 needs lib2.a and lib2.a needs lib1.a for linking. How can this be resolved. any thoughts on this would be helpful. thanks rsennat
4
2239
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 other through notifications of some sort. For example, when instance 1 does a certain action, instances 2, 3, and 4 should be notified about it so they can react accordingly. I'm unaware of existing Java classes that deal with this sort of thing,...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.