Looking for real-time strip chart for Linux

Kyler Laird Kyler at news.Lairds.org
Thu Oct 16 13:13:03 EDT 2003


Last month I wrote (in comp.os.linux.misc only):

>>Can anyone recommend a plotting/graphics package that would provide a
>>flexible real-time strip chart for Linux environment (or Linux + Windows
>>would be even better).

>No recommendation, but this looks like it might do the job.
>	http://jstripchart.sourceforge.net/

I can now make a recommendation.  This is cool!

I didn't find any examples of feeding the stripchart with data in
realtime so I hacked up the DemoTest class to include a timeout
handler that adds some data and refreshes the display.
        def update(self, widget, data=None):
                self.stripchart.data.append(self.stripchart.data[-1] + random.randrange(-100,100))
                self.stripchart.redraw()
                data_len = len(self.stripchart.data)

                if self.hscrollbar.get_value() + 101 >= self.hscroll_value:
                        self.hscroll_value = max(0, data_len - 50)
                        self.hscrollbar.set_value(self.hscroll_value)

                self.hscrollbar.set_range(0, data_len + 50)

                return(1)

This is a *horrible* kludge with a lot of hardcoded values (and errors,
I suspect), but it makes a surprisingly good demo.

I'm trying to interface to TinyOS (Java) devices using Python as much
as possible.  Having a tool to show results in realtime will be a big
help.

--kyler




More information about the Python-list mailing list