QPushButton with pixmap problem

C

Christopher Stone

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())
 
P

Phil Thompson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top