Search code examples
pythonmacosalignmentpyqt4qpushbutton

OSX QPushButton Text Alignment


When rendering a QPushButton using PyQt4 on OS X 10.10.5, the text is not centered in the button. Instead, the text appears to be aligned with the top edge of the button.

example screen shot

I tried:

self.pushButton.setStyleSheet("text-align: center")

but that had no apparent effect. Also, I do not see this problem when running the same code on Linux.

How can I vertically center QPushButton text on OS X?


Solution

  • I got the opposite problem, my text aligns to the bottom, I pushed it to the center by adding padding-bottom: 1px;.