class_docstr: Displays a rectangular bar to indicate the relative scale of objects on the view.
class_docstr_tok: ["Displays","a","rectangular","bar","to","indicate","the","relative","scale","of","objects","on","the","view","."]
code: def updateBar(self):
      view = self.parentItem()
      if view is None:
          return
      p1 = view.mapFromViewToItem(self, QtCore.QPointF(0, 0))
      p2 = view.mapFromViewToItem(self, QtCore.QPointF(self.size, 0))
      w = (p2 - p1).x()
      self.bar.setRect(QtCore.QRectF(-w, 0, w, self._width))
      self.text.setPos(-w / 2.0, 0)
  
file_path: pyqtgraph/pyqtgraph/graphicsItems/ScaleBar.py
imports: from ..None import functions
  from ..None import getConfigOption
  from ..Point import Point
  from ..Qt import QtCore, QtWidgets
  from .GraphicsObject import GraphicsObject
  from .GraphicsWidgetAnchor import GraphicsWidgetAnchor
  from .TextItem import TextItem
label_desc: Use image node_id 3 for calling the ScaleBar obj's underlying member method code with example usage: obj.updateBar() without return types