[PyQt] How to insert a picture

Matteo Bertozzi th30z at develer.com
Thu Jan 5 10:04:10 GMT 2012


On Thu, 2012-01-05 at 10:57 +0100, Fabien Lafont wrote:
> Hello,
> 
> I'm trying to insert a picture in PyQt. I've tried
> 
> LED = QLabel.setPixmap(QPixmap("LED_ON.PNG"))
> 
> but it returns:
> 
> LED = QLabel.setPixmap(QPixmap("LED_ON.PNG"))
> TypeError: QLabel.setPixmap(QPixmap): first argument of unbound method
> must have type 'QLabel'
> 
> Any Idea?

app = QApplication([])

label = QLabel()
label.setPixmap(QPixmap("LED_ON.PNG"))
label.show()

app.exec_()

-- 
Matteo Bertozzi <th30z at develer.com>
Develer S.r.l.



More information about the PyQt mailing list