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:

Enter image details here

padding needs to be set to zero with vertical axes:

  combo.setStyleSheet ('background color: gray; padding: 0px10px 0px10px;')  

Result:

Enter image details here


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -