Exemplo n.º 1
0
    def paintEvent(self, event):
        QFrame.paintEvent(self, event)
        p = QtGui.QPainter(self)
        pblack = QtGui.QPen(QColor("black"))
        pwhite = QtGui.QPen(QColor("white"))
        rect = QFrame.contentsRect(self)

        for wall in self.walls:
            if self.walls[wall] == True:
                p.setPen(pblack)
            else:
                p.setPen(pwhite)

            if wall == "T":
                # čára z prava do leva
                p.drawLine(rect.topLeft(), rect.topRight())
            elif wall == "B":
                p.drawLine(rect.bottomLeft(), rect.bottomRight())
            elif wall == "R":
                p.drawLine(rect.topRight(), rect.bottomRight())
            else:
                p.drawLine(rect.bottomLeft(), rect.topLeft())