class_docstr: **Bases:** QtWidgets.QAbstractSpinBox
  
  Extension of QSpinBox widget for selection of a numerical value.     
  Adds many extra features:
  
    * SI prefix notation (eg, automatically display "300 mV" instead of "0.003 V")
    * Float values with linear and decimal stepping (1-9, 10-90, 100-900, etc.)
    * Option for unbounded values
    * Delayed signals (allows multiple rapid changes with only one change signal)
    * Customizable text formatting
  
  =============================  ==============================================
  **Signals:**
  valueChanged(value)            Same as QSpinBox; emitted every time the value 
                                 has changed.
  sigValueChanged(self)          Emitted when value has changed, but also combines
                                 multiple rapid changes into one signal (eg, 
                                 when rolling the mouse wheel).
  sigValueChanging(self, value)  Emitted immediately for all value changes.
  =============================  ==============================================
class_docstr_tok: ["*","*","Bases",":","*","*","QtWidgets.QAbstractSpinBox","Extension","of","QSpinBox","widget","for","selection","of","a","numerical","value",".","Adds","many","extra","features",":","*","SI","prefix","notation","(","eg",",","automatically","display","``","300","mV","''","instead","of","``","0.003","V","''",")","*","Float","values","with","linear","and","decimal","stepping","(","1-9",",","10-90",",","100-900",",","etc",".",")","*","Option","for","unbounded","values","*","Delayed","signals","(","allows","multiple","rapid","changes","with","only","one","change","signal",")","*","Customizable","text","formatting","=============================","==============================================","*","*","Signals",":","*","*","valueChanged","(","value",")","Same","as","QSpinBox",";","emitted","every","time","the","value","has","changed",".","sigValueChanged","(","self",")","Emitted","when","value","has","changed",",","but","also","combines","multiple","rapid","changes","into","one","signal","(","eg",",","when","rolling","the","mouse","wheel",")",".","sigValueChanging","(","self",",","value",")","Emitted","immediately","for","all","value","changes",".","=============================","=============================================="]
docstr: Set options affecting the behavior of the SpinBox.
  
  ============== ========================================================================
  **Arguments:**
  bounds         (min,max) Minimum and maximum values allowed in the SpinBox. 
                 Either may be None to leave the value unbounded. By default, values are
                 unbounded.
  suffix         (str) suffix (units) to display after the numerical value. By default,
                 suffix is an empty str.
  siPrefix       (bool) If True, then an SI prefix is automatically prepended
                 to the units and the value is scaled accordingly. For example,
                 if value=0.003 and suffix='V', then the SpinBox will display
                 "300 mV" (but a call to SpinBox.value will still return 0.003). In case
                 the value represents a dimensionless quantity that might span many
                 orders of magnitude, such as a Reynolds number, an SI
                 prefix is allowed with no suffix. Default is False.
  prefix         (str) String to be prepended to the spin box value. Default is an empty string.
  step           (float) The size of a single step. This is used when clicking the up/
                 down arrows, when rolling the mouse wheel, or when pressing 
                 keyboard arrows while the widget has keyboard focus. Note that
                 the interpretation of this value is different when specifying
                 the 'dec' argument. If 'int' is True, 'step' is rounded to the nearest integer.
                 Default is 0.01 if 'int' is False and 1 otherwise.
  dec            (bool) If True, then the step value will be adjusted to match 
                 the current size of the variable (for example, a value of 15
                 might step in increments of 1 whereas a value of 1500 would
                 step in increments of 100). In this case, the 'step' argument
                 is interpreted *relative* to the current value. The most common
                 'step' values when dec=True are 0.1, 0.2, 0.5, and 1.0. Default is
                 False.
  minStep        (float) When dec=True, this specifies the minimum allowable step size.
  int            (bool) If True, the value is forced to integer type.
                 If True, 'step' is rounded to the nearest integer or defaults to 1.
                 Default is False
  finite         (bool) When False and int=False, infinite values (nan, inf, -inf) are
                 permitted. Default is True.
  wrapping       (bool) If True and both bounds are not None, spin box has circular behavior.
  decimals       (int) Number of decimal values to display. Default is 6. 
  format         (str) Formatting string used to generate the text shown. Formatting is
                 done with ``str.format()`` and makes use of several arguments:
                 
                   * *value* - the unscaled value of the spin box
                   * *prefix* - the prefix string
                   * *prefixGap* - a single space if a prefix is present, or an empty
                     string otherwise
                   * *suffix* - the suffix string
                   * *scaledValue* - the scaled value to use when an SI prefix is present
                   * *siPrefix* - the SI prefix string (if any), or an empty string if
                     this feature has been disabled
                   * *suffixGap* - a single space if a suffix is present, or an empty
                     string otherwise.
  regex          (str or RegexObject) Regular expression used to parse the spinbox text.
                 May contain the following group names:
                 
                 * *number* - matches the numerical portion of the string (mandatory)
                 * *siPrefix* - matches the SI prefix string
                 * *suffix* - matches the suffix string
                 
                 Default is defined in ``pyqtgraph.functions.FLOAT_REGEX``.
  evalFunc       (callable) Fucntion that converts a numerical string to a number,
                 preferrably a Decimal instance. This function handles only the numerical
                 of the text; it does not have access to the suffix or SI prefix.
  compactHeight  (bool) if True, then set the maximum height of the spinbox based on the
                 height of its font. This allows more compact packing on platforms with
                 excessive widget decoration. Default is True.
  ============== ========================================================================
docstr_tok: ["Set","options","affecting","the","behavior","of","the","SpinBox",".","==============","========================================================================","*","*","Arguments",":","*","*","bounds","(","min",",","max",")","Minimum","and","maximum","values","allowed","in","the","SpinBox",".","Either","may","be","None","to","leave","the","value","unbounded",".","By","default",",","values","are","unbounded",".","suffix","(","str",")","suffix","(","units",")","to","display","after","the","numerical","value",".","By","default",",","suffix","is","an","empty","str",".","siPrefix","(","bool",")","If","True",",","then","an","SI","prefix","is","automatically","prepended","to","the","units","and","the","value","is","scaled","accordingly",".","For","example",",","if","value=0.003","and","suffix=","'","V","'",",","then","the","SpinBox","will","display","``","300","mV","''","(","but","a","call","to","SpinBox.value","will","still","return","0.003",")",".","In","case","the","value","represents","a","dimensionless","quantity","that","might","span","many","orders","of","magnitude",",","such","as","a","Reynolds","number",",","an","SI","prefix","is","allowed","with","no","suffix",".","Default","is","False",".","prefix","(","str",")","String","to","be","prepended","to","the","spin","box","value",".","Default","is","an","empty","string",".","step","(","float",")","The","size","of","a","single","step",".","This","is","used","when","clicking","the","up\/","down","arrows",",","when","rolling","the","mouse","wheel",",","or","when","pressing","keyboard","arrows","while","the","widget","has","keyboard","focus",".","Note","that","the","interpretation","of","this","value","is","different","when","specifying","the","'dec","'","argument",".","If","'int","'","is","True",",","'step","'","is","rounded","to","the","nearest","integer",".","Default","is","0.01","if","'int","'","is","False","and","1","otherwise",".","dec","(","bool",")","If","True",",","then","the","step","value","will","be","adjusted","to","match","the","current","size","of","the","variable","(","for","example",",","a","value","of","15","might","step","in","increments","of","1","whereas","a","value","of","1500","would","step","in","increments","of","100",")",".","In","this","case",",","the","'step","'","argument","is","interpreted","*","relative","*","to","the","current","value",".","The","most","common","'step","'","values","when","dec=True","are","0.1",",","0.2",",","0.5",",","and","1.0",".","Default","is","False",".","minStep","(","float",")","When","dec=True",",","this","specifies","the","minimum","allowable","step","size",".","int","(","bool",")","If","True",",","the","value","is","forced","to","integer","type",".","If","True",",","'step","'","is","rounded","to","the","nearest","integer","or","defaults","to","1",".","Default","is","False","finite","(","bool",")","When","False","and","int=False",",","infinite","values","(","nan",",","inf",",","-inf",")","are","permitted",".","Default","is","True",".","wrapping","(","bool",")","If","True","and","both","bounds","are","not","None",",","spin","box","has","circular","behavior",".","decimals","(","int",")","Number","of","decimal","values","to","display",".","Default","is","6.","format","(","str",")","Formatting","string","used","to","generate","the","text","shown",".","Formatting","is","done","with","``","str.format","(",")","``","and","makes","use","of","several","arguments",":","*","*","value","*","-","the","unscaled","value","of","the","spin","box","*","*","prefix","*","-","the","prefix","string","*","*","prefixGap","*","-","a","single","space","if","a","prefix","is","present",",","or","an","empty","string","otherwise","*","*","suffix","*","-","the","suffix","string","*","*","scaledValue","*","-","the","scaled","value","to","use","when","an","SI","prefix","is","present","*","*","siPrefix","*","-","the","SI","prefix","string","(","if","any",")",",","or","an","empty","string","if","this","feature","has","been","disabled","*","*","suffixGap","*","-","a","single","space","if","a","suffix","is","present",",","or","an","empty","string","otherwise",".","regex","(","str","or","RegexObject",")","Regular","expression","used","to","parse","the","spinbox","text",".","May","contain","the","following","group","names",":","*","*","number","*","-","matches","the","numerical","portion","of","the","string","(","mandatory",")","*","*","siPrefix","*","-","matches","the","SI","prefix","string","*","*","suffix","*","-","matches","the","suffix","string","Default","is","defined","in","``","pyqtgraph.functions.FLOAT_REGEX","``",".","evalFunc","(","callable",")","Fucntion","that","converts","a","numerical","string","to","a","number",",","preferrably","a","Decimal","instance",".","This","function","handles","only","the","numerical","of","the","text",";","it","does","not","have","access","to","the","suffix","or","SI","prefix",".","compactHeight","(","bool",")","if","True",",","then","set","the","maximum","height","of","the","spinbox","based","on","the","height","of","its","font",".","This","allows","more","compact","packing","on","platforms","with","excessive","widget","decoration",".","Default","is","True",".","==============","========================================================================"]
code: def setOpts(self, **opts):
      """Set options affecting the behavior of the SpinBox.
  
      ============== ========================================================================
      **Arguments:**
      bounds         (min,max) Minimum and maximum values allowed in the SpinBox.
                     Either may be None to leave the value unbounded. By default, values are
                     unbounded.
      suffix         (str) suffix (units) to display after the numerical value. By default,
                     suffix is an empty str.
      siPrefix       (bool) If True, then an SI prefix is automatically prepended
                     to the units and the value is scaled accordingly. For example,
                     if value=0.003 and suffix='V', then the SpinBox will display
                     "300 mV" (but a call to SpinBox.value will still return 0.003). In case
                     the value represents a dimensionless quantity that might span many
                     orders of magnitude, such as a Reynolds number, an SI
                     prefix is allowed with no suffix. Default is False.
      prefix         (str) String to be prepended to the spin box value. Default is an empty string.
      step           (float) The size of a single step. This is used when clicking the up/
                     down arrows, when rolling the mouse wheel, or when pressing
                     keyboard arrows while the widget has keyboard focus. Note that
                     the interpretation of this value is different when specifying
                     the 'dec' argument. If 'int' is True, 'step' is rounded to the nearest integer.
                     Default is 0.01 if 'int' is False and 1 otherwise.
      dec            (bool) If True, then the step value will be adjusted to match
                     the current size of the variable (for example, a value of 15
                     might step in increments of 1 whereas a value of 1500 would
                     step in increments of 100). In this case, the 'step' argument
                     is interpreted *relative* to the current value. The most common
                     'step' values when dec=True are 0.1, 0.2, 0.5, and 1.0. Default is
                     False.
      minStep        (float) When dec=True, this specifies the minimum allowable step size.
      int            (bool) If True, the value is forced to integer type.
                     If True, 'step' is rounded to the nearest integer or defaults to 1.
                     Default is False
      finite         (bool) When False and int=False, infinite values (nan, inf, -inf) are
                     permitted. Default is True.
      wrapping       (bool) If True and both bounds are not None, spin box has circular behavior.
      decimals       (int) Number of decimal values to display. Default is 6.
      format         (str) Formatting string used to generate the text shown. Formatting is
                     done with ``str.format()`` and makes use of several arguments:
  
                       * *value* - the unscaled value of the spin box
                       * *prefix* - the prefix string
                       * *prefixGap* - a single space if a prefix is present, or an empty
                         string otherwise
                       * *suffix* - the suffix string
                       * *scaledValue* - the scaled value to use when an SI prefix is present
                       * *siPrefix* - the SI prefix string (if any), or an empty string if
                         this feature has been disabled
                       * *suffixGap* - a single space if a suffix is present, or an empty
                         string otherwise.
      regex          (str or RegexObject) Regular expression used to parse the spinbox text.
                     May contain the following group names:
  
                     * *number* - matches the numerical portion of the string (mandatory)
                     * *siPrefix* - matches the SI prefix string
                     * *suffix* - matches the suffix string
  
                     Default is defined in ``pyqtgraph.functions.FLOAT_REGEX``.
      evalFunc       (callable) Fucntion that converts a numerical string to a number,
                     preferrably a Decimal instance. This function handles only the numerical
                     of the text; it does not have access to the suffix or SI prefix.
      compactHeight  (bool) if True, then set the maximum height of the spinbox based on the
                     height of its font. This allows more compact packing on platforms with
                     excessive widget decoration. Default is True.
      ============== ========================================================================
      """
      # print opts
      for k, v in opts.items():
          if k == "bounds":
              self.setMinimum(v[0], update=False)
              self.setMaximum(v[1], update=False)
          elif k == "min":
              self.setMinimum(v, update=False)
          elif k == "max":
              self.setMaximum(v, update=False)
          elif k in ["step", "minStep"]:
              self.opts[k] = decimal.Decimal(str(v))
          elif k == "value":
              pass  ## don't set value until bounds have been set
          elif k == "format":
              self.opts[k] = str(v)
          elif k == "regex" and isinstance(v, str):
              self.opts[k] = re.compile(v)
          elif k in self.opts:
              self.opts[k] = v
          else:
              raise TypeError("Invalid keyword argument '%s'." % k)
      if "value" in opts:
          self.setValue(opts["value"])
  
      ## If bounds have changed, update value to match
      if "bounds" in opts and "value" not in opts:
          self.setValue()
  
      ## sanity checks:
      if self.opts["int"]:
          self.opts["step"] = round(self.opts.get("step", 1))
  
          if "minStep" in opts:
              step = opts["minStep"]
              if int(step) != step:
                  raise Exception(
                      "Integer SpinBox must have integer minStep size."
                  )
          else:
              ms = int(self.opts.get("minStep", 1))
              if ms < 1:
                  ms = 1
              self.opts["minStep"] = ms
  
          if "format" not in opts:
              self.opts[
                  "format"
              ] = "{prefix}{prefixGap}{value:d}{suffixGap}{suffix}"
  
      if self.opts["dec"]:
          if self.opts.get("minStep") is None:
              self.opts["minStep"] = self.opts["step"]
  
      if "delay" in opts:
          self.proxy.setDelay(opts["delay"])
  
      self.updateText()
  
imports: import decimal
  import re
  from math import isinf, isnan
  from ..None import functions
  from ..Qt import QtCore, QtGui, QtWidgets
  from ..SignalProxy import SignalProxy
label_desc: Use image node_id 2 for calling the SpinBox obj's underlying member method code with example usage: obj.setOpts() without return types