QPushButton with pixmap problem
Phil Thompson
phil at riverbankcomputing.co.uk
Sun Jun 27 04:47:05 EDT 2004
On Sunday 27 June 2004 2:11 am, Christopher Stone wrote:
> The following short program written in PyQt does not display the q2
> push button, does anyone know what I'm doing wrong?
>
> #!/usr/bin/env python
>
> import sys
> from qt import *
>
> class myQVBox(QVBox):
> def __init__(self):
> QVBox.__init__(self)
> q1 = QPushButton("Quit 1", self)
> q2 = QPushButton(QIconSet(QPixmap('mypix.png')),
> "Quit 2", self)
>
> app = QApplication(sys.argv)
> main = myQVBox()
>
> app.setMainWidget(main)
> main.show()
>
> sys.exit(app.exec_loop())
It's a bug in PyQt. It will be fixed in tonight's snapshot.
The workaround is to set the pixmap separately...
q2 = QPushButton("Quit 2", self)
q2.setIconSet(QIconSet(QPixmap('mypix.png')))
Phil
More information about the Python-list
mailing list