Method of setting TextEdit background using PyQt4

  • 2021-06-28 13:09:59
  • OfStack

Make a simple sharing first, and then fill in a complete use case when you have time


self.textEdit = QtGui.QTextEdit(slef)

1. Set the background color


self.textEdit.setStyleSheet("background:blue")

2. Set the background map


self.textEdit.setStyleSheet("background-image:url(timg.jpg)")

3. Set text background color


self.textEdit.setTextBackgroundColor(QtGui.QColor(255,0,0))

Related articles: