[PyQt] Image doesn't show up

Yaşar Arabacı yasar11732 at gmail.com
Sat Jun 25 01:50:42 BST 2011


Hi,

I am beginning to learn PyQt, I am sorry if this is a bit newbie question
but I can't make QIcon work.

For example in here;

#!/usr/bin/python

# menubar.py

import sys
from PyQt4 import QtGui, QtCore

class MainWindow(QtGui.QMainWindow):
   def __init__(self):
       QtGui.QMainWindow.__init__(self)

       self.resize(250,150)
       self.setWindowTitle('menubar')

       exit = QtGui.QAction(QtGui.QIcon('icons/no.png'),'Exit',self)
       exit.setShortcut('Ctrl+Q')
       exit.setStatusTip('Exit application')

 self.connect(exit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()'))


       self.statusBar()

       menubar = self.menuBar()
       file = menubar.addMenu('&File')
       file.addAction(exit)

app = QtGui.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())

My icon doesn't show up at the menu. And I am not getting any error messages
from the console. My icon file is 12x12 png file. Does it supposed to be
something else maybe?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110625/e257d765/attachment.html>


More information about the PyQt mailing list