PyQt5 textBrowser當前字體顏色、label背景顏色修改

label背景顏色修改

global paleteGreen, paleteRed
paleteGreen = QPalette()
paleteGreen.setColor(QPalette.Window, Qt.green)
paleteRed = QPalette()
paleteRed.setColor(QPalette.Window, Qt.red)
self.label_41.setPalette(paleteRed)
# self.label_41的autoFillBackground要設置爲True

textBrowser當前字體顏色

self.textBrowser.append("<font color='red'>" + '鴨舌標籤 {0} 與 上蓋標籤 {1} 不一致'.format(ducklabelSN, lidlabelSN) + "<font>")
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章