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__ |
Default class constructor. |
AddIndicator |
Adds an indicator to RulerCtrl . You should pass a unique id and a starting |
CheckStyle |
Adjust the RulerCtrl style 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 RulerCtrl bounds (its client rectangle). |
GetDrawingParent |
Returns the window to which RulerCtrl draws 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_BACKGROUND event for RulerCtrl . |
OnMouseEvents |
Handles the wx.EVT_MOUSE_EVENTS event for RulerCtrl . |
OnPaint |
Handles the wx.EVT_PAINT event for RulerCtrl . |
OnSize |
Handles the wx.EVT_SIZE event for RulerCtrl . |
SetBackgroundColour |
Sets the RulerCtrl background colour. |
SetBounds |
Sets the bounds for RulerCtrl (its client rectangle). |
SetDrawingParent |
Sets the window to which RulerCtrl draws 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 RulerCtrl should have a logarithmic scale or not. |
SetOrientation |
Sets the RulerCtrl orientation. |
SetRange |
Sets the RulerCtrl range. |
SetSpacing |
Sets the RulerCtrl spacing 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. |
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 – 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 for RulerCtrl
.
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 for RulerCtrl
.
Parameters: | event – a MouseEvent event to be processed. |
---|
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for RulerCtrl
.
Parameters: | event – a PaintEvent event to be processed. |
---|
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for RulerCtrl
.
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: |
|
---|
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
which RulerCtrl draws a thin line over. |
---|
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.
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 – True to send a RulerCtrlEvent , 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 or wx.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: |
|
---|
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. |
---|