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)¶
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¶
- __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.HORIZONTAL
ofwx.VERTICAL
.
- AddIndicator(self, id, value)¶
Adds an indicator to
RulerCtrl
. You should pass a uniqueid
and 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.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 –
True
to label major ticks,False
otherwise.
- LabelMinor(self, label=True)¶
Sets whether the minor ticks should be labeled or not.
- Parameters:
label –
True
to label minor ticks,False
otherwise.
- LabelString(self, d, major=None)¶
Used internally.
- OfflimitsPixels(self, start, end)¶
Used internally.
- OnEraseBackground(self, event)¶
Handles the
wx.EVT_ERASE_BACKGROUND
event forRulerCtrl
.- Parameters:
event – a
EraseEvent
event to be processed.
Note
This method is intentionally empty to reduce flicker.
- OnMouseEvents(self, event)¶
Handles the
wx.EVT_MOUSE_EVENTS
event forRulerCtrl
.- Parameters:
event – a
MouseEvent
event to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINT
event forRulerCtrl
.- Parameters:
event – a
PaintEvent
event to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZE
event forRulerCtrl
.- Parameters:
event – a
wx.SizeEvent
event 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:
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 –
True
to reverse the orientation of the tick marks,False
otherwise.
- 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
IntFormat
1
Integer format
RealFormat
2
Real format
TimeFormat
3
Time format
LinearDBFormat
4
Linear DB format
HHMMSS_Format
5
HHMMSS format
- SetIndicatorColour(self, id, colour=None)¶
Sets the indicator colour.
- Parameters:
id – the indicator identifier;
colour – a valid
wx.Colour
object.
Note
This method requires PIL to change the image palette.
- SetIndicatorValue(self, sendEvent=True)¶
Sets the indicator value.
- Parameters:
sendEvent –
True
to send aRulerCtrlEvent
,False
otherwise.
- SetLabelColour(self, colour=wx.BLACK)¶
Sets the labels colour.
- Parameters:
colour – a valid
wx.Colour
object.
- SetLabelEdges(self, labelEdges=True)¶
Sets whether the edge values should always be displayed or not.
- Parameters:
labelEdges –
True
to always display edge labels,False
otherwise/
- SetLog(self, log=True)¶
Sets whether
RulerCtrl
should have a logarithmic scale or not.- Parameters:
log –
True
to use a logarithmic scale,False
to use a linear one.
- SetOrientation(self, orient=None)¶
Sets the
RulerCtrl
orientation.- Parameters:
orient – can be
wx.HORIZONTAL
orwx.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.Colour
object.
- 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 –
True
if it is a major ticks,False
if it is a minor one.
- TickMajor(self, tick=True)¶
Sets whether the major ticks should be ticked or not.
- Parameters:
tick –
True
to show major ticks,False
otherwise.
- TickMinor(self, tick=True)¶
Sets whether the minor ticks should be ticked or not.
- Parameters:
tick –
True
to show minor ticks,False
otherwise.