class_docstr: GraphicsWidget displaying text.
  Used mainly as axis labels, titles, etc.
  
  Note: To display text inside a scaled view (ViewBox, PlotWidget, etc) use TextItem
code: def resizeEvent(self, ev):
      # c1 = self.boundingRect().center()
      # c2 = self.item.mapToParent(self.item.boundingRect().center()) # + self.item.pos()
      # dif = c1 - c2
      # self.item.moveBy(dif.x(), dif.y())
      # print c1, c2, dif, self.item.pos()
      self.item.setPos(0, 0)
      bounds = self.itemRect()
      left = self.mapFromItem(
          self.item, QtCore.QPointF(0, 0)
      ) - self.mapFromItem(self.item, QtCore.QPointF(1, 0))
      rect = self.rect()
  
      if self.opts["justify"] == "left":
          if left.x() != 0:
              bounds.moveLeft(rect.left())
          if left.y() < 0:
              bounds.moveTop(rect.top())
          elif left.y() > 0:
              bounds.moveBottom(rect.bottom())
  
      elif self.opts["justify"] == "center":
          bounds.moveCenter(rect.center())
          # bounds = self.itemRect()
          # self.item.setPos(self.width()/2. - bounds.width()/2., 0)
      elif self.opts["justify"] == "right":
          if left.x() != 0:
              bounds.moveRight(rect.right())
          if left.y() < 0:
              bounds.moveBottom(rect.bottom())
          elif left.y() > 0:
              bounds.moveTop(rect.top())
          # bounds = self.itemRect()
          # self.item.setPos(self.width() - bounds.width(), 0)
  
      self.item.setPos(bounds.topLeft() - self.itemRect().topLeft())
      self.updateMin()
  
file_path: pyqtgraph/pyqtgraph/graphicsItems/LabelItem.py
imports: from ..None import functions
  from ..None import getConfigOption
  from ..Qt import QtCore, QtWidgets, QtGui
  from .GraphicsWidget import GraphicsWidget
  from .GraphicsWidgetAnchor import GraphicsWidgetAnchor
label_desc: Use image node_id 4 for calling the LabelItem obj's underlying member method code with example usage: obj.resizeEvent(ev) without return types