RulerCtrl
implements a ruler window that can be placed on top, bottom, left or right
to any wxPython widget.
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.
RulerCtrl
has the following characteristics:
cm
, dB
, inches
) can be displayed together with the label values;wx.STATIC_BORDER
, wx.SUNKEN_BORDER
,
wx.DOUBLE_BORDER
, wx.NO_BORDER
, wx.RAISED_BORDER
, wx.SIMPLE_BORDER
);And a lot more. See the demo for a review of the functionalities.
Usage example:
import wx
import wx.lib.agw.rulerctrl as RC
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "RulerCtrl Demo")
panel = wx.Panel(self)
text = wx.TextCtrl(panel, -1, "Hello World! wxPython rules", style=wx.TE_MULTILINE)
ruler1 = RC.RulerCtrl(panel, -1, orient=wx.HORIZONTAL, style=wx.SUNKEN_BORDER)
ruler2 = RC.RulerCtrl(panel, -1, orient=wx.VERTICAL, style=wx.SUNKEN_BORDER)
mainsizer = wx.BoxSizer(wx.HORIZONTAL)
leftsizer = wx.BoxSizer(wx.VERTICAL)
bottomleftsizer = wx.BoxSizer(wx.HORIZONTAL)
topsizer = wx.BoxSizer(wx.HORIZONTAL)
leftsizer.Add((20, 20), 0, wx.ADJUST_MINSIZE, 0)
topsizer.Add((39, 0), 0, wx.ADJUST_MINSIZE, 0)
topsizer.Add(ruler1, 1, wx.EXPAND, 0)
leftsizer.Add(topsizer, 0, wx.EXPAND, 0)
bottomleftsizer.Add((10, 0))
bottomleftsizer.Add(ruler2, 0, wx.EXPAND, 0)
bottomleftsizer.Add(text, 1, wx.EXPAND, 0)
leftsizer.Add(bottomleftsizer, 1, wx.EXPAND, 0)
mainsizer.Add(leftsizer, 3, wx.EXPAND, 0)
panel.SetSizer(mainsizer)
# our normal wxApp-derived class, as usual
app = wx.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()
RulerCtrl
implements the following events related to indicators:
EVT_INDICATOR_CHANGING
: the user is about to change the position of one indicator;EVT_INDICATOR_CHANGED
: the user has changed the position of one indicator.RulerCtrl
has been tested on the following platforms:No particular window styles are available for this class.
This class processes the following events:
Event Name | Description |
---|---|
EVT_INDICATOR_CHANGED |
The user has changed the indicator value. |
EVT_INDICATOR_CHANGING |
The user is about to change the indicator value. |
RulerCtrl
is distributed under the wxPython license.
Latest Revision: Andrea Gavana @ 19 Dec 2012, 21.00 GMT
Version 0.4
ConvertPILToWX |
Converts a PIL image into a wx.Image . |
ConvertWXToPIL |
Converts a wx.Image into a PIL image. |
GetIndicatorBitmap |
Returns the image indicator as a wx.Bitmap . |
GetIndicatorData |
Returns the image indicator as a decompressed stream of characters. |
GetIndicatorImage |
Returns the image indicator as a wx.Image . |
MakePalette |
Creates a palette to be applied on an image based on input colour. |
Indicator |
This class holds all the information about a single indicator inside RulerCtrl . |
Label |
Auxilary class. Just holds information about a label in RulerCtrl . |
RulerCtrl |
RulerCtrl implements a ruler window that can be placed on top, bottom, left or right |
RulerCtrlEvent |
Represent details of the events that the RulerCtrl object sends. |
ConvertPILToWX
(pil, alpha=True)¶Converts a PIL image into a wx.Image
.
Parameters: |
|
---|
Note
Requires PIL (Python Imaging Library), which can be downloaded from http://www.pythonware.com/products/pil/
ConvertWXToPIL
(bmp)¶Converts a wx.Image
into a PIL image.
Parameters: | bmp – an instance of wx.Image . |
---|
Note
Requires PIL (Python Imaging Library), which can be downloaded from http://www.pythonware.com/products/pil/
GetIndicatorData
()¶Returns the image indicator as a decompressed stream of characters.
MakePalette
(tr, tg, tb)¶Creates a palette to be applied on an image based on input colour.
Parameters: |
|
---|