python - How to customize QComboBox with CSS -
Creates QComboBox
with five items in the code below .setStyleSheet () The color of the pull-down background changes using the
method. QtCore, QtGui app from PyQt4 import = QtGui.QApplication ([]) combo = QtGui.QComboBox () for category (5): combo.addItem ('% s'% id (i)) combo.setStyleSheet (' background -color: gray ') combo.show () sys.exit (app .exec_ ())
Question: Two white bars appearing above and below the ComboBox pull-down menu How to get rid of? Here's a screenshot showing the problem:
padding
needs to be set to zero with vertical axes:
combo.setStyleSheet ('background color: gray; padding: 0px10px 0px10px;')
Result:
Comments
Post a Comment