wx.lib.agw.rulerctrl.RulerCtrl¶
RulerCtrl implements a ruler window that can be placed on top, bottom, left or right
to any wxPython widget. It is somewhat similar to the rulers you can find in text
editors software, though not so powerful.
Class Hierarchy¶
Control Appearance¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Adds an indicator to |
|
Adjust the |
|
Actually draws the whole |
|
Actually draws the thin line over the drawing parent window. |
|
Used internally. |
|
Returns the |
|
Returns the window to which |
|
Returns the format used to display values in |
|
Returns the indicator located at the mouse position mousePos (if any). |
|
Returns the time format. |
|
Invalidates the ticks calculations. |
|
Sets whether the major ticks should be labeled or not. |
|
Sets whether the minor ticks should be labeled or not. |
|
Used internally. |
|
Used internally. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Sets the |
|
Sets the bounds for |
|
Sets the window to which |
|
Sets whether the orientation of the tick marks should be reversed. |
|
Sets the fonts for minor and major tick labels. |
|
Sets the format for |
|
Sets the indicator colour. |
|
Sets the indicator value. |
|
Sets the labels colour. |
|
Sets whether the edge values should always be displayed or not. |
|
Sets whether |
|
Sets the |
|
Sets the |
|
Sets the |
|
Sets the pen colour to draw the ticks. |
|
Sets the time format. |
|
Sets the units that should be displayed beside the labels. |
|
Ticks a particular position. |
|
Sets whether the major ticks should be ticked or not. |
|
Sets whether the minor ticks should be ticked or not. |
|
Updates all the ticks calculations. |
Class API¶
- class RulerCtrl(wx.Panel)¶
RulerCtrlimplements a ruler window that can be placed on top, bottom, left or right to any wxPython widget. It is somewhat similar to the rulers you can find in text editors software, though not so powerful.
Methods¶
- __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.STATIC_BORDER, orient=wx.HORIZONTAL)¶
Default class constructor.
- Parameters:
parent – parent window. Must not be
None;id – window identifier. A value of -1 indicates a default value;
pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
style – the window style;
orient – sets the orientation of the
RulerCtrl, and can be eitherwx.HORIZONTALofwx.VERTICAL.
- AddIndicator(self, id, value)¶
Adds an indicator to
RulerCtrl. You should pass a uniqueidand a starting value for the indicator.- Parameters:
id – the indicator identifier;
value – the indicator initial value.
- DrawOnParent(self, indicator)¶
Actually draws the thin line over the drawing parent window.
- Parameters:
indicator – the current indicator, an instance of
Indicator.
Note
This method is currently not available on wxMac as it uses
ScreenDC.
- FindLinearTickSizes(self, UPP)¶
Used internally.
- GetFormat(self)¶
Returns the format used to display values in
RulerCtrl.See also
RulerCtrl.SetFormatfor a list of possible formats.
- GetIndicator(self, mousePos)¶
Returns the indicator located at the mouse position mousePos (if any).
- Parameters:
mousePos – the mouse position, an instance of
wx.Point.
- GetTimeFormat(self)¶
Returns the time format.
- Invalidate(self)¶
Invalidates the ticks calculations.
- LabelMajor(self, label=True)¶
Sets whether the major ticks should be labeled or not.
- Parameters:
label –
Trueto label major ticks,Falseotherwise.
- LabelMinor(self, label=True)¶
Sets whether the minor ticks should be labeled or not.
- Parameters:
label –
Trueto label minor ticks,Falseotherwise.
- LabelString(self, d, major=None)¶
Used internally.
- OfflimitsPixels(self, start, end)¶
Used internally.
- OnEraseBackground(self, event)¶
Handles the
wx.EVT_ERASE_BACKGROUNDevent forRulerCtrl.- Parameters:
event – a
EraseEventevent to be processed.
Note
This method is intentionally empty to reduce flicker.
- OnMouseEvents(self, event)¶
Handles the
wx.EVT_MOUSE_EVENTSevent forRulerCtrl.- Parameters:
event – a
MouseEventevent to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINTevent forRulerCtrl.- Parameters:
event – a
PaintEventevent to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZEevent forRulerCtrl.- Parameters:
event – a
wx.SizeEventevent to be processed.
- SetBackgroundColour(self, colour)¶
Sets the
RulerCtrlbackground colour.- Parameters:
colour – an instance of
wx.Colour.
Note
Overridden from
Panel.
- SetBounds(self, left, top, right, bottom)¶
Sets the bounds for
RulerCtrl(its client rectangle).- Parameters:
left – the left corner of the client rectangle;
top – the top corner of the client rectangle;
right – the right corner of the client rectangle;
bottom – the bottom corner of the client rectangle.
- SetFlip(self, flip=True)¶
Sets whether the orientation of the tick marks should be reversed.
- Parameters:
flip –
Trueto reverse the orientation of the tick marks,Falseotherwise.
- SetFonts(self, minorFont, majorFont)¶
Sets the fonts for minor and major tick labels.
- SetFormat(self, format)¶
Sets the format for
RulerCtrl.- Parameters:
format –
the format used to display values in
RulerCtrl. This can be one of the following bits:Format
Value
Description
IntFormat1
Integer format
RealFormat2
Real format
TimeFormat3
Time format
LinearDBFormat4
Linear DB format
HHMMSS_Format5
HHMMSS format
- SetIndicatorColour(self, id, colour=None)¶
Sets the indicator colour.
- Parameters:
id – the indicator identifier;
colour – a valid
wx.Colourobject.
Note
This method requires PIL to change the image palette.
- SetIndicatorValue(self, sendEvent=True)¶
Sets the indicator value.
- Parameters:
sendEvent –
Trueto send aRulerCtrlEvent,Falseotherwise.
- SetLabelColour(self, colour=wx.BLACK)¶
Sets the labels colour.
- Parameters:
colour – a valid
wx.Colourobject.
- SetLabelEdges(self, labelEdges=True)¶
Sets whether the edge values should always be displayed or not.
- Parameters:
labelEdges –
Trueto always display edge labels,Falseotherwise/
- SetLog(self, log=True)¶
Sets whether
RulerCtrlshould have a logarithmic scale or not.- Parameters:
log –
Trueto use a logarithmic scale,Falseto use a linear one.
- SetOrientation(self, orient=None)¶
Sets the
RulerCtrlorientation.- Parameters:
orient – can be
wx.HORIZONTALorwx.VERTICAL.
- SetSpacing(self, spacing)¶
Sets the
RulerCtrlspacing between labels.- Parameters:
spacing – the spacing between labels, in pixels.
- SetTickPenColour(self, colour=wx.BLACK)¶
Sets the pen colour to draw the ticks.
- Parameters:
colour – a valid
wx.Colourobject.
- SetTimeFormat(self, format=TimeFormat)¶
Sets the time format.
- Parameters:
format – the format used to display time values.
- SetUnits(self, units)¶
Sets the units that should be displayed beside the labels.
- Parameters:
units – the units that should be displayed beside the labels.
- Tick(self, dc, pos, d, major)¶
Ticks a particular position.
- Parameters:
dc – an instance of
wx.DC;pos – the label position;
d – the current label value;
major –
Trueif it is a major ticks,Falseif it is a minor one.
- TickMajor(self, tick=True)¶
Sets whether the major ticks should be ticked or not.
- Parameters:
tick –
Trueto show major ticks,Falseotherwise.
- TickMinor(self, tick=True)¶
Sets whether the minor ticks should be ticked or not.
- Parameters:
tick –
Trueto show minor ticks,Falseotherwise.