Currently i am using border-image to get the shape.I want to change color of hexagon dynamically. if i try to change the color of hexagon using background-color, only the square back-ground color is changing.


img.png


class ExampleApp(QtGui.QMainWindow):
def __init__(self):
super(self.__class__, self).__init__()
self.myFunction()

def myFunction(self):
self.newWindow = design_3.Ui_MainWindow()
self.newWindow.setupUi(self);
self.newWindow.campusNameLabel.setStyleSheet("QLab el { color : white; }");
self.newWindow.campusNameLabel.setText("Label 1")


gridLayout = QtGui.QGridLayout()
gridLayout.setSpacing(5)
gridLayout.setRowStretch(1,1)
gridLayout.setVerticalSpacing(20)


alertBtn = QtGui.QPushButton("myBtn",self)
alertBtn.setAutoFillBackground(True)
alertBtn.setFlat(True)
alertBtn.setSizePolicy(QtGui.QSizePolicy.Preferred , QtGui.QSizePolicy.Preferred)
alertBtn.setMaximumWidth(150)
alertBtn.setMaximumHeight(150)
alertBtn.setMinimumWidth(150)
alertBtn.setMinimumHeight(150)


alertBtn.setStyleSheet("border-image: url(rsz_imagetest.png);background-color:black;")
gridLayout.addWidget(alertBtn,0,0)
self.newWindow.verticalLayout_2.addLayout(gridLayo ut)