FloatSpin implements a floating point wx.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.
__init__ | Default class constructor. |
ClampValue | Clamps var between _min and _max depending if the range has been specified. |
DoGetBestSize | Gets the size which best suits the window: for a control, it would be the |
DoSendEvent | Send the event to the parent. |
GetDefaultValue | Returns the FloatSpin default value. |
GetDigits | Returns the number of digits shown. |
GetFont | Returns the underlying wx.TextCtrl font. |
GetFormat | Returns the string format in use. |
GetIncrement | Returns the increment for every EVT_FLOATSPIN event. |
GetMax | Returns the maximum value for FloatSpin. It can be a |
GetMin | Returns the minimum value for FloatSpin. It can be a |
GetSnapToTicks | Returns whether the snap to ticks option is active or not. |
GetTextCtrl | Returns the underlying wx.TextCtrl. |
GetValue | Returns the FloatSpin value. |
HasRange | Returns whether FloatSpin range has been set or not. |
InRange | Returns whether a value is inside FloatSpin range. |
IsDefaultValue | Returns whether the current value is the default value or not. |
IsFinite | Tries to determine if a value is finite or infinite/NaN. |
OnChar | Handles the wx.EVT_CHAR event for FloatSpin. |
OnDestroy | Handles the wx.EVT_WINDOW_DESTROY event for FloatSpin. |
OnFocus | Handles the wx.EVT_SET_FOCUS event for FloatSpin. |
OnKillFocus | Handles the wx.EVT_KILL_FOCUS event for FloatSpin. |
OnMouseWheel | Handles the wx.EVT_MOUSEWHEEL event for FloatSpin. |
OnSize | Handles the wx.EVT_SIZE event for FloatSpin. |
OnSpinDown | Handles the wx.EVT_SPIN_DOWN event for FloatSpin. |
OnSpinMouseDown | Handles the wx.EVT_LEFT_DOWN event for FloatSpin. |
OnSpinUp | Handles the wx.EVT_SPIN_UP event for FloatSpin. |
OnTextEnter | Handles the wx.EVT_TEXT_ENTER event for FloatSpin. |
ReplaceDoubleZero | Replaces the (somewhat) python ugly +e000 with +e00. |
SetDefaultValue | Sets the FloatSpin default value. |
SetDigits | Sets the number of digits to show. |
SetFont | Sets the underlying wx.TextCtrl font. |
SetFormat | Set the string format to use. |
SetIncrement | Sets the increment for every EVT_FLOATSPIN event. |
SetRange | Sets the allowed range. |
SetRangeDontClampValue | Sets the allowed range. |
SetSnapToTicks | Force the value to always be divisible by the increment. |
SetToDefaultValue | Sets FloatSpin value to its default value. |
SetValue | Sets the FloatSpin value. |
SyncSpinToText | Synchronize the underlying wx.TextCtrl with wx.SpinButton. |
FloatSpin implements a floating point wx.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.
Default class constructor.
Parameters: |
|
---|
Clamps var between _min and _max depending if the range has been specified.
Parameters: | var – the value to be clamped. |
---|---|
Returns: | A clamped copy of var. |
Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().
Note
Overridden from wx.PyControl.
Returns the underlying wx.TextCtrl font.
Returns the string format in use.
See also
SetFormat for a list of valid string formats.
Returns the maximum value for FloatSpin. It can be a number or None if no minimum is present.
Returns the minimum value for FloatSpin. It can be a number or None if no minimum is present.
Returns the underlying wx.TextCtrl.
Returns whether a value is inside FloatSpin range.
Parameters: | value – the value to test. |
---|
Tries to determine if a value is finite or infinite/NaN.
Parameters: | value – the value to test. |
---|
Handles the wx.EVT_CHAR event for FloatSpin.
Parameters: | event – a wx.KeyEvent event to be processed. |
---|
Note
This method works on the underlying wx.TextCtrl.
Handles the wx.EVT_WINDOW_DESTROY event for FloatSpin.
Parameters: | event – a wx.WindowDestroyEvent event to be processed. |
---|
Note
This method tries to correctly handle the control destruction under MSW.
Handles the wx.EVT_SET_FOCUS event for FloatSpin.
Parameters: | event – a wx.FocusEvent event to be processed. |
---|
Handles the wx.EVT_KILL_FOCUS event for FloatSpin.
Parameters: | event – a wx.FocusEvent event to be processed. |
---|
Handles the wx.EVT_MOUSEWHEEL event for FloatSpin.
Parameters: | event – a wx.MouseEvent event to be processed. |
---|
Handles the wx.EVT_SIZE event for FloatSpin.
Parameters: | event – a wx.SizeEvent event to be processed. |
---|
Note
This method resizes the text control and reposition the spin button when resized.
Handles the wx.EVT_SPIN_DOWN event for FloatSpin.
Parameters: | event – a wx.SpinEvent event to be processed. |
---|
Handles the wx.EVT_LEFT_DOWN event for FloatSpin.
Parameters: | event – a wx.MouseEvent event to be processed. |
---|
Note
This method works on the underlying wx.SpinButton.
Handles the wx.EVT_SPIN_UP event for FloatSpin.
Parameters: | event – a wx.SpinEvent event to be processed. |
---|
Handles the wx.EVT_TEXT_ENTER event for FloatSpin.
Parameters: | event – a wx.KeyEvent event to be processed. |
---|
Note
This method works on the underlying wx.TextCtrl.
Replaces the (somewhat) python ugly +e000 with +e00.
Parameters: | strs – a string (possibly) containing a +e00 substring. |
---|
Sets the FloatSpin default value.
Parameters: | defaultvalue – a floating point value representing the new default value for FloatSpin. |
---|
Sets the number of digits to show.
Parameters: | digits – the number of digits to show. If digits < 0, FloatSpin tries to calculate the best number of digits based on input values passed in the constructor. |
---|
Sets the underlying wx.TextCtrl font.
Parameters: | font – a valid instance of wx.Font. |
---|
Set the string format to use.
Parameters: | fmt – the new string format to use. One of the following strings:
|
---|
Sets the increment for every EVT_FLOATSPIN event.
Parameters: | increment – a floating point number specifying the FloatSpin increment. |
---|
Sets the allowed range.
Parameters: |
---|
Note
This method doesn’t modify the current value.
Note
You specify open ranges like this (you can equally do this in the constructor):
SetRange(min_val=1, max_val=None)
SetRange(min_val=None, max_val=0)
or no range:
SetRange(min_val=None, max_val=None)
Sets the allowed range.
Parameters: |
---|
Note
This method doesn’t modify the current value.
Force the value to always be divisible by the increment. Initially False.
Parameters: | forceticks – True to force the snap to ticks option, False otherwise. |
---|
Note
This uses the default value as the basis, you will get strange results for very large differences between the current value and default value when the increment is very small.
Synchronize the underlying wx.TextCtrl with wx.SpinButton.
Parameters: |
|
---|