Slider
- class lib.cli.actions.Slider(*args, min_max: tuple[int, int] | tuple[float, float] | None = None, rounding: int | None = None, **kwargs)
Bases:
ActionAdds support for a slider in the GUI.
The standard
argparse.Actionis extended with the additional parameters listed below. Thedefaultvalue must be supplied and thetypemust be eitherintorfloat.nargsare explicitly disallowed.- Parameters:
min_max (tuple) – The (min, max) values that the slider’s range should be set to. The values should be a pair of float or int data types, depending on the data type of the slider. NB: These min/max values are not enforced, they are purely for setting the slider range. Values outside of this range can still be explicitly passed in from the cli.
rounding (int) – If the underlying data type for the option is a float then this value is the number of decimal places to round the slider values to. If the underlying data type for the option is an int then this is the step interval between each value for the slider.
Examples
For integer values:
>>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=Slider, >>> min_max=(0, 10) >>> rounding=1 >>> type=int, >>> default=5))
For floating point values:
>>> argument_list = [] >>> argument_list.append(dict( >>> opts=("-f", "--foobar"), >>> action=Slider, >>> min_max=(0.00, 1.00) >>> rounding=2 >>> type=float, >>> default=5.00))
Methods Summary
__call__(parser, namespace, values[, ...])Call self as a function.
Methods Documentation
- __call__(parser, namespace, values, option_string=None) None
Call self as a function.
- Return type:
None
- format_usage()
- __call__(parser, namespace, values, option_string=None) None
Call self as a function.
- Return type:
None