title: Drawing Triangles with PyQt5
body: <p>I have a <code>QGraphicsScene</code>, one which I'm trying to add a triangle via a <code>QGraphicsPolygonItem</code>.</p>
  
  <pre><code>class MainScene(QtWidgets.QGraphicsScene):
  def __init__(self, *args, parent=None):
      self.brush = QtGui.QBrush('94c3e4')
      QtWidgets.QGraphicsScene.__init__(self, parent, *args)
      self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor.fromRgb(209, 233, 249)))
  ....
  ## run every time a point is selected to become part of a triangle
      TrianglePts.append(Points2[indexW].scenePos())
      Points2[indexW].greenSelect()
      if len(TrianglePts) == 3:
          print(TrianglePts)
          triangle = TriangleItem(QtGui.QPolygonF(TrianglePts))
          self.addItem(triangle)
  
  
  class TriangleItem(QtWidgets.QGraphicsPolygonItem):
      def __init__(self, polygon, parent=None):
          QtWidgets.QGraphicsPolygonItem.__init__(self, polygon, parent)
          self.setBrush(QtGui.QBrush(QtGui.QColor.fromRgb(249, 245, 209)))
  </code></pre>
  
  <p>For some reason, the triangle is never rendered. I do something similar to render points, and it seems to work. Here's the custom class for that:</p>
  
  <pre><code>class VertexItem(QtWidgets.QGraphicsEllipseItem):
  def __init__(self, x, y, parent=None):
      self.x = x
      self.y = y
      QtWidgets.QGraphicsEllipseItem.__init__(self,parent)
      self.setRect(x, y, 20, 20)
      #self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable)
      #self.setFlags(QtWidgets.QGraphicsItem.ItemIsSelectable)
      #self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable)
      self.setAcceptHoverEvents(True)
  </code></pre>
  
  <p>Does anyone know what I need to do to get the triangles to render? I'm happy to provide any more necessary code.</p>