| |
- Drawable_1D
class Drawable_1D |
|
1D Graphics displaying widget interface definition
Application Level Interface:
===========================
This class has some methods that can be called at application level. They refer to adding
and changing graphical elements over the graphic displaying. They are called through
View.GetDrawable() object:
PutLine
PutRectangle
PutSymbol
PutText
SetObjectCoords
GetObjectCoords
EraseObject
UpdateObject
This class generates the following callbacks to parent (a View object):
_RightButtonPress
_ButtonPress
_DoubleClick
_ButtonRelease
_Motion
_ButtonPressMotion
_KeyPress |
|
- DataCoord2ViewCoord(self, coord)
- Tranforms data coordinates (coordinates of the displayed axis) into
view coordinates (as generated by the events)
- Destroy(self)
- Cleanup
- EnableLegend(self, enable, position='bottom')
- Parameters:
enable: if non-zero adds legend. If zero, removes.
position: if enable is non-zero sets the position of the legend: "top", "left",
"right" or "bottom"
- EraseObject(self, obj)
- Erases graphical object
Parameters:
obj: reference to the object
- GetFunctionScale(self, name)
- Returns which y axis the function named "name" is referenced to
- GetHeight(self)
- Returns height of the widget
- GetObjectCoords(self, obj)
- Parameters:
obj: reference to the object
Returns the coordinates of the graphical object in data coords = coordinates
of the displayed axis
- GetVisibleXAxis(self)
- Returns the visible x axis (lower and higher values)
- GetVisibleY2Axis(self)
- Returns the visible y2 axis (lower and higher values)
- GetVisibleYAxis(self)
- Returns the visible y axis (lower and higher values)
- GetWidth(self)
- Returns width of the widget
- ImageCoord2ViewCoord(self, coord)
- Tranforms image coordinates (referenced to original image) into
view coordinates (as generated by the events)
- IncrementalUpdate(self, function_name, range, restart=0)
- Draws just the interval defined bu
Parameters:
function_name: name of the function
range: tuple,(min,max) values for updating
restart: if non-zero, erases previously displayed functions values
of function_name
- PutLine(self, X0, Y0, X1, Y1, pen=<PyDVT.GUIBinding.Binding.Pen instance>, yscale=0)
- Parameters:
X0,Y0: First point (data coords = coordinates of the displayed axis)
X1,Y1: Second point (data coords = coordinates of the displayed axis)
pen: Pen object
yscale: if equals to 1 it's referenced to second y axis
Returns a reference to the object
- PutRectangle(self, X0, Y0, X1, Y1, pen=<PyDVT.GUIBinding.Binding.Pen instance>, brush=<PyDVT.GUIBinding.Binding.Brush instance>, yscale=0)
- Parameters:
X0,Y0: upper-left corner (data coords = coordinates of the displayed axis)
X1,Y1: lower-right corner (data coords = coordinates of the displayed axis)
pen: Pen object to the contour
brush: Brush object for the filling
yscale: if equals to 1 it's referenced to second y axis
Returns a reference to the object
- PutSymbol(self, X0, Y0, symbol='circle', pen=<PyDVT.GUIBinding.Binding.Pen instance>, yscale=0)
- Parameters:
X0,Y0: Location (data coords = coordinates of the displayed axis)
symbol: 'circle', square', 'diamond', 'plus', 'cross', 'star' or 'triangle'
pen: Pen object
yscale: if equals to 1 it's referenced to second y axis
Returns a reference to the object
- PutText(self, X0, Y0, text, align='center', orient=0.0, pen=<PyDVT.GUIBinding.Binding.Pen instance>, style='normal', yscale=0, brush=<PyDVT.GUIBinding.Binding.Brush instance>)
- Parameters:
X0,Y0: Location (data coords = coordinates of the displayed axis)
align: 'center', 'left' or 'right'
orient: angle (in degrees) of the text
pen: Pen object for the text
style: 'normal', 'bold' oe 'italic'
yscale: if equals to 1 it's referenced to second y axis
brush: Brush object for the background
Returns a reference to the object
- Redraw(self)
- Draws itself
- RemoveFunction(self, name=None)
- Parameters:
name: name of the function to be removed from the drawable.
if none, all are removed
- RemoveGraphicObjects(self)
- Removes all graphical objects on the plotting
(Added with the Put... methods)
- ResetZoom(self, update=1)
- Parameters:
update: if non-zero triggers a Redraw
- Save(self, filename, format)
- Parameters:
filename: name of the output file.
format: format to be saved ("PS","PNG","BMP" or "JPG")
- SetEnv(self, xmin, xmax, ymin, ymax, y2min=None, y2max=None, reset_zoom=0)
- Parameters:
xmin,xmax: lower,upper values of x axis
ymin,ymax: lower,upper values of y axis
y2min,y2max: lower,upper values of y2 axis
reset_zoom: if non-zero, resets zoom state.
- SetFunction(self, name, function_pars)
- Parameters:
name: name of the function to be included
function_pars: dictionary with the function properties (see GraphView)
In addiction:
"valid_range": tuple, defines a validity interval
(the functions is only drawn in this interval)
- SetFunctionItem(self, name, item, val)
- Sets "item" of the function named "name" to the value "val"
- SetLabels(self, title_label=None, x_label=None, y_label=None, y2_label=None)
- Parameters:
title_label: Label on the top of drawing
x_label: Label for x axis
y_label: Label for y axis
y2_label: Label for second (right-side) y axis
- SetLogX(self, on, minvalue=1)
- Parameters:
on: if non-zero sets x axis logarithmic
if zero, sets x axis linear
minvalue: if on is non-zero sets the displaying value
for all values lass than or equals to zero
- SetLogY(self, on, minvalue=9.9999999999999995e-07)
- Sets drawing limits
Parameters:
on: if non-zero sets y axis logarithmic
if zero, sets y axis linear
minvalue: if on is non-zero sets the displaying value
for all values lass than or equals to zero
- SetObjectCoords(self, obj, *args)
- Changes the coordinates of an graphical object
Parameters:
obj: reference to the object
*args: X0,Y0,X1,Y1,... in data coords = coordinates of the displayed axis
- SetPolarEnv(self, value)
- Parameters:
value: if non-zero enable polar environment
if zero, disables
- SetStyle(self, style)
- Parameters:
style: "Line", "Points", "PointsLine" or "Bars"
- SetZoom(self, (x0, y0), (x1, y1))
- Parameters:
(x0,y0): upper-left corner
(x1,y1): upper-left corner
- Show(self)
- Displays widget
- ToggleGridlines(self)
- Toggles gridline state (initial state: off)
- UpdateObject(self, obj, pen=None, brush=None, textOptsDic=None)
- Changes properties of an object
Parameters:
pen: new Pen object
brush: new Brush object
textOptsDic: dictionary with new text properties
keys: 'orient', 'align', 'text', 'style'
values as in PutText method
- ViewCoord2DataCoord(self, coord)
- Tranforms view coordinates (as generated by the events) into
data coordinates (coordinates of the displayed axis)
- ViewCoord2ImageCoord(self, coord)
- Tranforms view coordinates (as generated by the events) into
image coordinates ( referenced to original image )
- __init__(self, parent, zoom_mode='ON', scroll_mode='ON')
- Parameters:
parent: parent widget (a View object)
zoom_mode: "ON" or "OFF" "
scroll_mode: "ON", "OFF" or "AUTO"
| |