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.
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. |
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.
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 either
wx.HORIZONTAL
of wx.VERTICAL
.
AddIndicator
(self, id, value)¶Adds an indicator to RulerCtrl
. You should pass a unique id and a starting
value for the indicator.
id – the indicator identifier;
value – the indicator initial value.
DrawOnParent
(self, indicator)¶Actually draws the thin line over the drawing parent window.
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).
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.
label – True
to label major ticks, False
otherwise.
LabelMinor
(self, label=True)¶Sets whether the minor ticks should be labeled or not.
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 for RulerCtrl
.
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 for RulerCtrl
.
event – a MouseEvent
event to be processed.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for RulerCtrl
.
event – a PaintEvent
event to be processed.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for RulerCtrl
.
event – a wx.SizeEvent
event to be processed.
SetBackgroundColour
(self, colour)¶Sets the RulerCtrl
background colour.
colour – an instance of wx.Colour
.
Note
Overridden from Panel
.
SetBounds
(self, left, top, right, bottom)¶Sets the bounds for RulerCtrl
(its client rectangle).
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.
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
.
format –
the format used to display values in RulerCtrl
. This can be
one of the following bits:
Format |
Value |
Description |
---|---|---|
|
1 |
Integer format |
|
2 |
Real format |
|
3 |
Time format |
|
4 |
Linear DB format |
|
5 |
HHMMSS format |
SetIndicatorColour
(self, id, colour=None)¶Sets the indicator colour.
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.
sendEvent – True
to send a RulerCtrlEvent
, False
otherwise.
SetLabelColour
(self, colour=wx.BLACK)¶Sets the labels colour.
colour – a valid wx.Colour
object.
SetLabelEdges
(self, labelEdges=True)¶Sets whether the edge values should always be displayed or not.
labelEdges – True
to always display edge labels, False
otherwise/
SetLog
(self, log=True)¶Sets whether RulerCtrl
should have a logarithmic scale or not.
log – True
to use a logarithmic scale, False
to use a
linear one.
SetOrientation
(self, orient=None)¶Sets the RulerCtrl
orientation.
orient – can be wx.HORIZONTAL
or wx.VERTICAL
.
SetSpacing
(self, spacing)¶Sets the RulerCtrl
spacing between labels.
spacing – the spacing between labels, in pixels.
SetTickPenColour
(self, colour=wx.BLACK)¶Sets the pen colour to draw the ticks.
colour – a valid wx.Colour
object.
SetTimeFormat
(self, format=TimeFormat)¶Sets the time format.
format – the format used to display time values.
SetUnits
(self, units)¶Sets the units that should be displayed beside the labels.
units – the units that should be displayed beside the labels.
Tick
(self, dc, pos, d, major)¶Ticks a particular position.
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.
tick – True
to show major ticks, False
otherwise.
TickMinor
(self, tick=True)¶Sets whether the minor ticks should be ticked or not.
tick – True
to show minor ticks, False
otherwise.