phoenix_title wx.lib.masked.numctrl.NumCtrl

Masked edit control supporting “native” numeric values, ie. .SetValue(3), for example, and supporting a variety of formatting options, including automatic rounding specifiable precision, grouping and decimal place characters, etc.


class_hierarchy Class Hierarchy

Inheritance diagram for class NumCtrl:

super_classes Known Superclasses

wx.lib.masked.numctrl.NumCtrlAccessorsMixin, wx.lib.masked.textctrl.BaseMaskedTextCtrl


method_summary Methods Summary

__init__

Default class constructor.

ChangeValue

Sets the value of the control to the value specified.

GetAllowNegative

(For regularization of property accessors)

GetAllowNone

(For regularization of property accessors)

GetAutoSize

GetBounds

This function returns a two-tuple (min,max), indicating the

GetDecimalChar

GetFraction

Returns the fractional portion of the value as a float. If there is no

GetFractionWidth

Get the fraction width.

GetGroupChar

GetGroupDigits

(For regularization of property accessors)

GetIntegerWidth

Get the integer width.

GetLimited

(For regularization of property accessors)

GetLimitOnFieldChange

(For regularization of property accessors)

GetMax

Gets the maximum value of the control. It will return the current

GetMin

Gets the lower bound value of the control. It will return

GetSelectOnEntry

GetValue

Returns the current numeric value of the control.

IsGroupingAllowed

IsInBounds

Returns True if no value is specified and the current value

IsLimited

Returns True if the control is currently limiting the

IsLimitedOnFieldChange

Returns True if the control is currently limiting the

IsNegativeAllowed

IsNoneAllowed

OnTextChange

Handles an event indicating that the text control’s value

SetAllowNegative

SetAllowNone

Change the behavior of the validation code, allowing control

SetAutoSize

SetBounds

This function is a convenience function for setting the min and max

SetDecimalChar

SetFractionWidth

Set the fraction width of the control

SetGroupChar

SetGroupDigits

SetIntegerWidth

Set the integer width of the control

SetLimited

If called with a value of True, this function will cause the control

SetLimitOnFieldChange

If called with a value of True, this function will cause the control

SetMax

Sets the maximum value of the control. If a value of None

SetMin

Sets the minimum value of the control. If a value of None

SetParameters

This function is used to initialize and reconfigure the control.

SetSelectOnEntry

SetValue

Sets the value of the control to the value specified.


api Class API

class NumCtrl(BaseMaskedTextCtrl, NumCtrlAccessorsMixin)

Masked edit control supporting “native” numeric values, ie. .SetValue(3), for example, and supporting a variety of formatting options, including automatic rounding specifiable precision, grouping and decimal place characters, etc.


Methods

__init__(self, parent, id=-1, value = 0, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TE_PROCESS_TAB, validator = wx.DefaultValidator, name = "masked.num", **kwargs)

Default class constructor.

Parameters:
  • parent (wx.Window) – the window parent. Must not be None;

  • id (integer) – window identifier. A value of -1 indicates a default value;

  • value (integer) – value to be shown;

  • pos (tuple or wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;

  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;

  • style (integer) – the window style;

  • validator (wx.Validator) – this is mainly provided for data-transfer, as control does its own validation;

  • name (string) – the window name;



ChangeValue(self, value)

Sets the value of the control to the value specified. The resulting actual value of the control may be altered to conform with the bounds set on the control if limited, or colored if not limited but the value is out-of-bounds. A ValueError exception will be raised if an invalid value is specified.

This method does not fire a change event.

Parameters:

value (integer) – new value



GetAllowNegative(self)

(For regularization of property accessors)



GetAllowNone(self)

(For regularization of property accessors)



GetAutoSize(self)


GetBounds(self)

This function returns a two-tuple (min,max), indicating the current bounds of the control. Each value can be None if that bound is not set.



GetDecimalChar(self)


GetFraction(self, candidate=None)

Returns the fractional portion of the value as a float. If there is no fractional portion, the value returned will be 0.0.



GetFractionWidth(self)

Get the fraction width.



GetGroupChar(self)


GetGroupDigits(self)

(For regularization of property accessors)



GetIntegerWidth(self)

Get the integer width.



GetLimited(self)

(For regularization of property accessors)



GetLimitOnFieldChange(self)

(For regularization of property accessors)



GetMax(self)

Gets the maximum value of the control. It will return the current maximum integer, or None if not specified.



GetMin(self)

Gets the lower bound value of the control. It will return None if not specified.



GetSelectOnEntry(self)


GetValue(self)

Returns the current numeric value of the control.



IsGroupingAllowed(self)


IsInBounds(self, value=None)

Returns True if no value is specified and the current value of the control falls within the current bounds. This function can also be called with a value to see if that value would fall within the current bounds of the given control.

Parameters:

value – value to check



IsLimited(self)

Returns True if the control is currently limiting the value to fall within the current bounds.



IsLimitedOnFieldChange(self)

Returns True if the control is currently limiting the value to fall within the current bounds.



IsNegativeAllowed(self)


IsNoneAllowed(self)


OnTextChange(self, event)

Handles an event indicating that the text control’s value has changed, and issue EVT_NUM event.

Note

Using TextCtrl.SetValue to change the control’s contents from within a EVT_CHAR handler can cause double text events. So we check for actual changes to the text before passing the events on.



SetAllowNegative(self, value)


SetAllowNone(self, allow_none)

Change the behavior of the validation code, allowing control to have a value of None or not, as appropriate. If the value of the control is currently None, and allow_none is False, the value of the control will be set to the minimum value of the control, or 0 if no lower bound is set.

Parameters:

allow_none (boolean) – True if None is allowed



SetAutoSize(self, value)


SetBounds(self, min=None, max=None)

This function is a convenience function for setting the min and max values at the same time. The function only applies the maximum bound if setting the minimum bound is successful, and returns True only if both operations succeed.

Note

leaving out an argument will remove the corresponding bound.

Parameters:
  • min (integer or None) – Minimum value for the control

  • max (integer or None) – Minimum value for the control



SetDecimalChar(self, value)


SetFractionWidth(self, value)

Set the fraction width of the control

Parameters:

value (integer) – the width value



SetGroupChar(self, value)


SetGroupDigits(self, value)


SetIntegerWidth(self, value)

Set the integer width of the control

Parameters:

value (integer) – the width value



SetLimited(self, limited)

If called with a value of True, this function will cause the control to limit the value to fall within the bounds currently specified. If the control’s value currently exceeds the bounds, it will then be limited accordingly.

If called with a value of False, this function will disable value limiting, but coloring of out-of-bounds values will still take place if bounds have been set for the control.

Parameters:

limited (boolean) – define value limiting



SetLimitOnFieldChange(self, limit)

If called with a value of True, this function will cause the control to prevent navigation out of the current field if its value is out-of-bounds, and limit the value to fall within the bounds currently specified if the control loses focus.

If called with a value of False, this function will disable value limiting, but coloring of out-of-bounds values will still take place if bounds have been set for the control.

Parameters:

limit (boolean) – define value limiting



SetMax(self, max=None)

Sets the maximum value of the control. If a value of None is provided, then the control will have no explicit maximum value. If the value specified is less than the current minimum value, then the function returns False and the maximum will not change from its current setting. On success, the function returns True.

If successful and the current value is greater than the new upper bound, if the control is limited the value will be automatically adjusted to this maximum value; if not limited, the value in the control will be colored as invalid.

If max > the max value allowed by the width of the control, the function will return False, and the max will not be set.

Parameters:

max (integer or None) – Minimum value for the control



SetMin(self, min=None)

Sets the minimum value of the control. If a value of None is provided, then the control will have no explicit minimum value. If the value specified is greater than the current maximum value, then the function returns False and the minimum will not change from its current setting. On success, the function returns True.

If successful and the current value is lower than the new lower bound, if the control is limited, the value will be automatically adjusted to the new minimum value; if not limited, the value in the control will be colored as invalid.

If min > the max value allowed by the width of the control, the function will return False, and the min will not be set.

Parameters:

min (integer or None) – Minimum value for the control



SetParameters(self, **kwargs)

This function is used to initialize and reconfigure the control. See TimeCtrl module overview for available parameters.



SetSelectOnEntry(self, value)


SetValue(self, value)

Sets the value of the control to the value specified. The resulting actual value of the control may be altered to conform with the bounds set on the control if limited, or colored if not limited but the value is out-of-bounds. A ValueError exception will be raised if an invalid value is specified.

Parameters:

value (integer) – new value