Package wx :: Package lib :: Package agw :: Module floatspin
[frames | no frames]

Module wx.lib.agw.floatspin

Description:

FloatSpin implements a floating point spinctrl. It is built using a custom wx.PyControl, composed by a wx.TextCtrl and a wx.SpinButton. In order to correctly handle floating points numbers without rounding errors or non-exact floating point representations, FloatSpin uses the great FixedPoint class from Tim Peters.

What you can do:

Events Catched:

FloatSpin catched 3 different types of events:

  1. Spin events: events generated by spinning up/down the spinbutton;
  2. Char events: playing with up/down arrows of the keyboard increase/decrease the value of FloatSpin;
  3. Mouse wheel event: using the wheel will change the value of FloatSpin.

In addition, there are some other functionalities:

It remembers the initial value as a default value, call SetToDefaultValue, or press <ESC> to return to it

shift + arrow = 2 * increment (or shift + mouse wheel) ctrl + arrow = 10 * increment (or ctrl + mouse wheel) alt + arrow = 100 * increment (or alt + mouse wheel)

Combinations of shift, ctrl, alt increment the FloatSpin value by the product of the factors;

pgup & pgdn = 10 * increment * the product of the shift, ctrl, alt factors;

<space> sets the control's value to it's last valid State.

Usage:

FloatSpin construction can be summarized as Follows:

FloatSpin.__init__(self, parent, id, pos=wx.defaultposition,
size=wx.defaultsize, style=0, value=0.0, min_val=None, max_val=None, increment=1.0, digits=-1, extrastyle=FS_LEFT, name="FloatSpin")

Where:

See FloatSpin __init__() method for the definition of non standard (non wxPython) parameters.

FloatSpin control is freeware and distributed under the wxPython license.

Latest revision: Andrea Gavana @ 15 Oct 2008, 10.00 GMT Version 0.5

Modifications to allow min_val or max_val to be None done by:

James Bigler sci institute, university of utah march 14, 2007

Note that the changes i made will break backward compatibility, because i changed the contructor's parameters from min/max to min_val/max_val to be consistent with the other functions and to eliminate any potential confusion with the built in min and max functions.

You specify open ranges like this (you can equally do this in the constructor):

[1,] => SetRange(min_val=1, max_val=None) [,0] => SetRange(min_val=None, max_val=0)

or no range:

[,] => Setrange(min_val=None, max_val=None)


Classes
FixedPoint  
FloatSpin  
FloatSpinEvent This event will be sent when a EVT_FLOATSPIN event is mapped in the parent.
FloatTextCtrl  

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:54:54 2009 http://epydoc.sf.net