1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.rulerctrl
.. highlight:: python
.. _wx.lib.agw.rulerctrl.RulerCtrl:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.rulerctrl.RulerCtrl**
==========================================================================================================================================
:class:`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| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>RulerCtrl</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.rulerctrl.RulerCtrl_inheritance.png" alt="Inheritance diagram of RulerCtrl" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Panel.html" title="wx.Panel" alt="" coords="75,315,151,344"/> <area shape="rect" id="node7" href="wx.lib.agw.rulerctrl.RulerCtrl.html" title="wx.lib.agw.rulerctrl.RulerCtrl" alt="" coords="16,392,211,421"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.rulerctrl.rulerctrl.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.rulerctrl.rulerctrl.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Panel`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.__init__` Default class constructor.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.AddIndicator` Adds an indicator to :class:`RulerCtrl`. You should pass a unique `id` and a starting
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.CheckStyle` Adjust the :class:`RulerCtrl` style accordingly to borders, units, etc...
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.Draw` Actually draws the whole :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.DrawOnParent` Actually draws the thin line over the drawing parent window.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.FindLinearTickSizes` Used internally.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.GetBounds` Returns the :class:`RulerCtrl` bounds (its client rectangle).
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.GetDrawingParent` Returns the window to which :class:`RulerCtrl` draws a thin line over.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.GetFormat` Returns the format used to display values in :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.GetIndicator` Returns the indicator located at the mouse position `mousePos` (if any).
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.GetTimeFormat` Returns the time format.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.Invalidate` Invalidates the ticks calculations.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.LabelMajor` Sets whether the major ticks should be labeled or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.LabelMinor` Sets whether the minor ticks should be labeled or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.LabelString` Used internally.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.OfflimitsPixels` Used internally.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.OnMouseEvents` Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetBackgroundColour` Sets the :class:`RulerCtrl` background colour.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetBounds` Sets the bounds for :class:`RulerCtrl` (its client rectangle).
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetDrawingParent` Sets the window to which :class:`RulerCtrl` draws a thin line over.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetFlip` Sets whether the orientation of the tick marks should be reversed.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetFonts` Sets the fonts for minor and major tick labels.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetFormat` Sets the format for :class:`RulerCtrl`.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetIndicatorColour` Sets the indicator colour.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetIndicatorValue` Sets the indicator value.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetLabelColour` Sets the labels colour.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetLabelEdges` Sets whether the edge values should always be displayed or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetLog` Sets whether :class:`RulerCtrl` should have a logarithmic scale or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetOrientation` Sets the :class:`RulerCtrl` orientation.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetRange` Sets the :class:`RulerCtrl` range.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetSpacing` Sets the :class:`RulerCtrl` spacing between labels.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetTickPenColour` Sets the pen colour to draw the ticks.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetTimeFormat` Sets the time format.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.SetUnits` Sets the units that should be displayed beside the labels.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.Tick` Ticks a particular position.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.TickMajor` Sets whether the major ticks should be ticked or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.TickMinor` Sets whether the minor ticks should be ticked or not.
:meth:`~wx.lib.agw.rulerctrl.RulerCtrl.Update` Updates all the ticks calculations.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: RulerCtrl(wx.Panel)
:class:`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.
.. method:: __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.STATIC_BORDER, orient=wx.HORIZONTAL)
Default class constructor.
:param `parent`: parent window. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `style`: the window style;
:param `orient`: sets the orientation of the :class:`RulerCtrl`, and can be either
``wx.HORIZONTAL`` of ``wx.VERTICAL``.
.. method:: AddIndicator(self, id, value)
Adds an indicator to :class:`RulerCtrl`. You should pass a unique `id` and a starting
`value` for the indicator.
:param `id`: the indicator identifier;
:param `value`: the indicator initial value.
.. method:: CheckStyle(self)
Adjust the :class:`RulerCtrl` style accordingly to borders, units, etc...
.. method:: Draw(self, dc)
Actually draws the whole :class:`RulerCtrl`.
:param `dc`: an instance of :class:`wx.DC`.
.. method:: DrawOnParent(self, indicator)
Actually draws the thin line over the drawing parent window.
:param `indicator`: the current indicator, an instance of :class:`Indicator`.
:note: This method is currently not available on wxMac as it uses :class:`ScreenDC`.
.. method:: FindLinearTickSizes(self, UPP)
Used internally.
.. method:: GetBounds(self)
Returns the :class:`RulerCtrl` bounds (its client rectangle).
.. method:: GetDrawingParent(self)
Returns the window to which :class:`RulerCtrl` draws a thin line over.
.. method:: GetFormat(self)
Returns the format used to display values in :class:`RulerCtrl`.
:see: :meth:`RulerCtrl.SetFormat` for a list of possible formats.
.. method:: GetIndicator(self, mousePos)
Returns the indicator located at the mouse position `mousePos` (if any).
:param `mousePos`: the mouse position, an instance of :class:`wx.Point`.
.. method:: GetTimeFormat(self)
Returns the time format.
.. method:: Invalidate(self)
Invalidates the ticks calculations.
.. method:: LabelMajor(self, label=True)
Sets whether the major ticks should be labeled or not.
:param `label`: ``True`` to label major ticks, ``False`` otherwise.
.. method:: LabelMinor(self, label=True)
Sets whether the minor ticks should be labeled or not.
:param `label`: ``True`` to label minor ticks, ``False`` otherwise.
.. method:: LabelString(self, d, major=None)
Used internally.
.. method:: OfflimitsPixels(self, start, end)
Used internally.
.. method:: OnEraseBackground(self, event)
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RulerCtrl`.
:param `event`: a :class:`EraseEvent` event to be processed.
:note: This method is intentionally empty to reduce flicker.
.. method:: OnMouseEvents(self, event)
Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`RulerCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPaint(self, event)
Handles the ``wx.EVT_PAINT`` event for :class:`RulerCtrl`.
:param `event`: a :class:`PaintEvent` event to be processed.
.. method:: OnSize(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`RulerCtrl`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: SetBackgroundColour(self, colour)
Sets the :class:`RulerCtrl` background colour.
:param `colour`: an instance of :class:`wx.Colour`.
:note: Overridden from :class:`Panel`.
.. method:: SetBounds(self, left, top, right, bottom)
Sets the bounds for :class:`RulerCtrl` (its client rectangle).
:param `left`: the left corner of the client rectangle;
:param `top`: the top corner of the client rectangle;
:param `right`: the right corner of the client rectangle;
:param `bottom`: the bottom corner of the client rectangle.
.. method:: SetDrawingParent(self, dparent)
Sets the window to which :class:`RulerCtrl` draws a thin line over.
:param `dparent`: an instance of :class:`wx.Window`, representing the window to
which :class:`RulerCtrl` draws a thin line over.
.. method:: SetFlip(self, flip=True)
Sets whether the orientation of the tick marks should be reversed.
:param `flip`: ``True`` to reverse the orientation of the tick marks, ``False``
otherwise.
.. method:: SetFonts(self, minorFont, majorFont)
Sets the fonts for minor and major tick labels.
:param `minorFont`: the font used to draw minor ticks, a valid :class:`wx.Font` object;
:param `majorFont`: the font used to draw major ticks, a valid :class:`wx.Font` object.
.. method:: SetFormat(self, format)
Sets the format for :class:`RulerCtrl`.
:param `format`: the format used to display values in :class:`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
====================== ======= ==============================
.. method:: SetIndicatorColour(self, id, colour=None)
Sets the indicator colour.
:param `id`: the indicator identifier;
:param `colour`: a valid :class:`wx.Colour` object.
:note: This method requires PIL to change the image palette.
.. method:: SetIndicatorValue(self, sendEvent=True)
Sets the indicator value.
:param `sendEvent`: ``True`` to send a :class:`RulerCtrlEvent`, ``False`` otherwise.
.. method:: SetLabelColour(self, colour=wx.BLACK)
Sets the labels colour.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetLabelEdges(self, labelEdges=True)
Sets whether the edge values should always be displayed or not.
:param `labelEdges`: ``True`` to always display edge labels, ``False`` otherwise/
.. method:: SetLog(self, log=True)
Sets whether :class:`RulerCtrl` should have a logarithmic scale or not.
:param `log`: ``True`` to use a logarithmic scale, ``False`` to use a
linear one.
.. method:: SetOrientation(self, orient=None)
Sets the :class:`RulerCtrl` orientation.
:param `orient`: can be ``wx.HORIZONTAL`` or ``wx.VERTICAL``.
.. method:: SetRange(self, minVal, maxVal)
Sets the :class:`RulerCtrl` range.
:param `minVal`: the minimum value of :class:`RulerCtrl`;
:param `maxVal`: the maximum value of :class:`RulerCtrl`.
.. method:: SetSpacing(self, spacing)
Sets the :class:`RulerCtrl` spacing between labels.
:param `spacing`: the spacing between labels, in pixels.
.. method:: SetTickPenColour(self, colour=wx.BLACK)
Sets the pen colour to draw the ticks.
:param `colour`: a valid :class:`wx.Colour` object.
.. method:: SetTimeFormat(self, format=TimeFormat)
Sets the time format.
:param `format`: the format used to display time values.
.. method:: SetUnits(self, units)
Sets the units that should be displayed beside the labels.
:param `units`: the units that should be displayed beside the labels.
.. method:: Tick(self, dc, pos, d, major)
Ticks a particular position.
:param `dc`: an instance of :class:`wx.DC`;
:param `pos`: the label position;
:param `d`: the current label value;
:param `major`: ``True`` if it is a major ticks, ``False`` if it is a minor one.
.. method:: TickMajor(self, tick=True)
Sets whether the major ticks should be ticked or not.
:param `tick`: ``True`` to show major ticks, ``False`` otherwise.
.. method:: TickMinor(self, tick=True)
Sets whether the minor ticks should be ticked or not.
:param `tick`: ``True`` to show minor ticks, ``False`` otherwise.
.. method:: Update(self, dc)
Updates all the ticks calculations.
:param `dc`: an instance of :class:`wx.DC`.
|