 
       wx.lib.agw.rulerctrl.RulerCtrl¶
  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.
 Methods Summary¶
 Methods Summary¶| __init__ | Default class constructor. | 
| AddIndicator | Adds an indicator to RulerCtrl. You should pass a unique id and a starting | 
| CheckStyle | Adjust the RulerCtrlstyle accordingly to borders, units, etc... | 
| Draw | Actually draws the whole RulerCtrl. | 
| DrawOnParent | Actually draws the thin line over the drawing parent window. | 
| FindLinearTickSizes | Used internally. | 
| GetBounds | Returns the RulerCtrlbounds (its client rectangle). | 
| GetDrawingParent | Returns the window to which RulerCtrldraws a thin line over. | 
| GetFormat | Returns the format used to display values in RulerCtrl. | 
| GetIndicator | Returns the indicator located at the mouse position mousePos (if any). | 
| GetTimeFormat | Returns the time format. | 
| Invalidate | Invalidates the ticks calculations. | 
| LabelMajor | Sets whether the major ticks should be labeled or not. | 
| LabelMinor | Sets whether the minor ticks should be labeled or not. | 
| LabelString | Used internally. | 
| OfflimitsPixels | Used internally. | 
| OnEraseBackground | Handles the wx.EVT_ERASE_BACKGROUNDevent forRulerCtrl. | 
| OnMouseEvents | Handles the wx.EVT_MOUSE_EVENTSevent forRulerCtrl. | 
| OnPaint | Handles the wx.EVT_PAINTevent forRulerCtrl. | 
| OnSize | Handles the wx.EVT_SIZEevent forRulerCtrl. | 
| SetBackgroundColour | Sets the RulerCtrlbackground colour. | 
| SetBounds | Sets the bounds for RulerCtrl(its client rectangle). | 
| SetDrawingParent | Sets the window to which RulerCtrldraws a thin line over. | 
| SetFlip | Sets whether the orientation of the tick marks should be reversed. | 
| SetFonts | Sets the fonts for minor and major tick labels. | 
| SetFormat | Sets the format for RulerCtrl. | 
| SetIndicatorColour | Sets the indicator colour. | 
| SetIndicatorValue | Sets the indicator value. | 
| SetLabelColour | Sets the labels colour. | 
| SetLabelEdges | Sets whether the edge values should always be displayed or not. | 
| SetLog | Sets whether RulerCtrlshould have a logarithmic scale or not. | 
| SetOrientation | Sets the RulerCtrlorientation. | 
| SetRange | Sets the RulerCtrlrange. | 
| SetSpacing | Sets the RulerCtrlspacing between labels. | 
| SetTickPenColour | Sets the pen colour to draw the ticks. | 
| SetTimeFormat | Sets the time format. | 
| SetUnits | Sets the units that should be displayed beside the labels. | 
| Tick | Ticks a particular position. | 
| TickMajor | Sets whether the major ticks should be ticked or not. | 
| TickMinor | Sets whether the minor ticks should be ticked or not. | 
| Update | Updates all the ticks calculations. | 
 Class API¶
 Class API¶RulerCtrl(wx.Panel)¶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.
__init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.STATIC_BORDER, orient=wx.HORIZONTAL)¶Default class constructor.
| Parameters: | 
 | 
|---|
AddIndicator(self, id, value)¶Adds an indicator to RulerCtrl. You should pass a unique id and a starting
value for the indicator.
| Parameters: | 
 | 
|---|
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.SetFormat for 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_BACKGROUND event for RulerCtrl.
| Parameters: | event – a EraseEventevent to be processed. | 
|---|
Note
This method is intentionally empty to reduce flicker.
OnMouseEvents(self, event)¶Handles the wx.EVT_MOUSE_EVENTS event for RulerCtrl.
| Parameters: | event – a MouseEventevent to be processed. | 
|---|
OnPaint(self, event)¶Handles the wx.EVT_PAINT event for RulerCtrl.
| Parameters: | event – a PaintEventevent to be processed. | 
|---|
OnSize(self, event)¶Handles the wx.EVT_SIZE event for RulerCtrl.
| Parameters: | event – a wx.SizeEventevent to be processed. | 
|---|
SetBackgroundColour(self, colour)¶Sets the RulerCtrl background 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: | 
 | 
|---|
SetDrawingParent(self, dparent)¶Sets the window to which RulerCtrl draws a thin line over.
| Parameters: | dparent – an instance of wx.Window, representing the window to
whichRulerCtrldraws a thin line over. | 
|---|
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.
| Parameters: | 
|---|
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:
 | 
|---|
SetIndicatorColour(self, id, colour=None)¶Sets the indicator colour.
| Parameters: | 
 | 
|---|
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 RulerCtrl should have a logarithmic scale or not.
| Parameters: | log – Trueto use a logarithmic scale,Falseto use a
linear one. | 
|---|
SetOrientation(self, orient=None)¶Sets the RulerCtrl orientation.
| Parameters: | orient – can be wx.HORIZONTALorwx.VERTICAL. | 
|---|
SetSpacing(self, spacing)¶Sets the RulerCtrl spacing 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: | 
 | 
|---|
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. | 
|---|