Class StripChart
Basic stripchart widget.
This widget displays data in a stripchart form. The data to be
displayed can be set by setting the data member of the class. The data can be any object which can be
accessed as a sequence, and for which the length can be queried using
len(data). For example, a list or an array is valid for data:
>>> import array, stripchart
>>> s = stripchart.StripChart()
>>> data = array.array("d", range(0,100))
>>> s.data = data
>>> data = [ 1, 2, 3, 4, 5 ]
>>> s.data = data
>>> number = 42.0
>>> s.data = number
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: data does not support len()
>>>
The data points are displayed as a connected line. If individual data
points are spread apart enough for them to be separately distinguished
then they are also displayed as small x marks on the line at
each point location. The distance between each data point is the sampling
period, which is 1/(sampling frequency). The widget can only display data
with a constant sampling frequency
The horizontal and vertical scales/extents of the component are
controlled by the hadjustment and vadjustment instance variables, To
understand the interpretation of these adjustments please see the VGrade widget documentation.
The StripChart may also have a selection
enabled. The selection is a single contiguous region of the chart which
the user may select by clicking and dragging with the left mouse button.
To enable selections, set the selection instance variable to a valid
gtk.Adjustment. The selection adjustment has its
lower member set to the minimum of the selection range and
its upper member set to the maximum of the selection range
(note that this is different from the interpretation of
gtk.Adjustments used for controlling the range). The
gtk.Adjustment used for the selection may be shared among multiple StripCharts to allow the same selection to
be displayed on all of them.
For example, the following sets the selection of a StripChart to the range [10.0, 42.0]. Note that the value,
step_incr, page_incr and page_size
instance variables may be ignored in this step:
>>> import gtk, stripchart
>>> s = stripchart.StripChart()
>>> s.selection = gtk.Adjustment(0, 10.0, 42.0)
| Method Summary |
| |
__init__(self,
hadjustment,
vadjustment,
selection)
Initializes the widget. |
| |
__delattr__(self,
name)
Delete attributes method. |
| |
__setattr__(self,
name,
value)
Set attributes method. |
| |
redraw(self)
Queues a redraw event for the widget. |
| Instance Variable Summary |
| Any object which can be accessed as a sequence. |
data: Data displayed by the widget. |
gtk.Adjustment |
hadjustment: Controls the horizontal range displayed. |
float |
period: Sampling period for the data. |
gtk.Adjustment |
selection: The selected region of the StripChart. |
gtk.Adjustment |
vadjustment: Controls the vertical range displayed. |
gtk.DrawingArea |
widget: Read-only pseudo-parent widget. |
__init__(self,
hadjustment=None,
vadjustment=None,
selection=None)
(Constructor)
Initializes the widget.
-
- Parameters:
hadjustment -
See hadjustment. If this is
None then a default gtk.Adjustment is
created.
vadjustment -
See vadjustment. If this is
None then a default gtk.Adjustment is
created.
selection -
See selection. If this is
None then no selection is enabled. To set up an
empty selection use gtk.Adjustment(-1).
|
__delattr__(self,
name)
Delete attributes method.
-
|
__setattr__(self,
name,
value)
Set attributes method.
-
|
redraw(self)
Queues a redraw event for the widget.
This method may be used, for example, when the data instance variable has changed and
the widget must be redrawn to reflect the change.
-
|
| Instance Variable Details |
data
Data displayed by the widget.
-
- Type:
-
Any object which can be accessed as a sequence.
|
hadjustment
Controls the horizontal range displayed.
-
- Type:
-
gtk.Adjustment
|
period
Sampling period for the data. Equal to 1 / (sampling
frequency).
-
- Type:
-
float
|
selection
The selected region of the StripChart.
-
- Type:
-
gtk.Adjustment
|
vadjustment
Controls the vertical range displayed.
-
- Type:
-
gtk.Adjustment
|
widget
Read-only pseudo-parent widget.
-
- Type:
-
gtk.DrawingArea
|