class_docstr: Controls the appearance of a QPen value.
  
  When `saveState` is called, the value is encoded as (color, width, style, capStyle, joinStyle, cosmetic)
  
  ============== ========================================================
  **Options:**
  color          pen color, can be any argument accepted by :func:`~pyqtgraph.mkColor` (defaults to black)
  width          integer width >= 0 (defaults to 1)
  style          String version of QPenStyle enum, i.e. 'SolidLine' (default), 'DashLine', etc.
  capStyle       String version of QPenCapStyle enum, i.e. 'SquareCap' (default), 'RoundCap', etc.
  joinStyle      String version of QPenJoinStyle enum, i.e. 'BevelJoin' (default), 'RoundJoin', etc.
  cosmetic       Boolean, whether or not the pen is cosmetic (defaults to True)
  ============== ========================================================
docstr: Applies settings from a pen to either a Parameter or dict. The Parameter or dict must already
  be populated with the relevant keys that can be found in `PenSelectorDialog.mkParam`.
docstr_tok: ["Applies","settings","from","a","pen","to","either","a","Parameter","or","dict",".","The","Parameter","or","dict","must","already","be","populated","with","the","relevant","keys","that","can","be","found","in","`","PenSelectorDialog.mkParam","`","."]
code: def updateFromPen(param, pen):
      """
      Applies settings from a pen to either a Parameter or dict. The Parameter or dict must already
      be populated with the relevant keys that can be found in `PenSelectorDialog.mkParam`.
      """
      stack = ExitStack()
      if isinstance(param, Parameter):
          names = param.names
          # Block changes until all are finalized
          stack.enter_context(param.treeChangeBlocker())
      else:
          names = param
      for opt in names:
          # Booleans have different naming convention
          if isinstance(param[opt], bool):
              attrName = f"is{opt.title()}"
          else:
              attrName = opt
          param[opt] = getattr(pen, attrName)()
      stack.close()
  
imports: import re
  from contextlib import ExitStack
  from .None import GroupParameterItem, WidgetParameterItem
  from .basetypes import GroupParameter, Parameter, ParameterItem
  from .qtenum import QtEnumParameter
  from ...None import functions
  from ...Qt import QtCore, QtWidgets
  from ...SignalProxy import SignalProxy
  from ...widgets.PenPreviewLabel import PenPreviewLabel
label_desc: Use image node_id 13 for calling the PenParameter obj's underlying member method code with example usage: obj.updateFromPen(param, pen) without return types