问题
I have message response as you see on the above. I've managed to colour background to black:
msg.setStyleSheet("background-color: rgb(0, 0, 0);")
I've tried with same way for the text but it looks like this:
msg.setStyleSheet("text-color: rgb(255, 255, 255);")
My only purpose is texts are white and background is black...
Here is my part of code:
msg = QMessageBox()
msg.setText("Message has been sended")
msg.setWindowTitle("SENT")
msg.setWindowIcon(QtGui.QIcon("black tic.png"))
msg.setIcon(QMessageBox.Information)
msg.setStyleSheet("background-color: rgb(0, 0, 0);")
msg.setStyleSheet("text-color: rgb(255, 255, 255);")
msg.exec_()
回答1:
To change the color of the text of a QMessageBox
, you have to use the following line
msgBox.setStyleSheet("QLabel{ color: white}");
来源:https://stackoverflow.com/questions/50222954/qmessagebox-background-and-text-color