This is a static archive of the Python wiki, which was retired in February 2026 due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

Show an image using a label

On the #pyqt IRC channel on Freenode, elhobab asked how to show an image.

   1 import sys
   2 from PyQt4.QtGui import *
   3 
   4 app = QApplication(sys.argv)
   5 
   6 label = QLabel()
   7 pixmap = QPixmap(sys.argv[1])
   8 label.setPixmap(pixmap)
   9 label.show()
  10 
  11 sys.exit(app.exec_())

2026-02-14 16:12