Найти - Пользователи
Полная версия: pyqt не отображает иконки
Начало » GUI » pyqt не отображает иконки
1
hcfnhmrx@sharklasers.com
Знакомился в pyqt по мануалу http://wiki.python.su/%D0%94%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B0%D1%86%D0%B8%D0%B8/%D0%92%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5%D0%92%D0%A1%D1%80%D0%B5%D0%B4%D1%83PyQt4#A.2BBB8EMAQ9BDUEOwRM_.2BBDgEPQRBBEIEQARDBDwENQQ9BEIEPgQy-

Возникла проблема со следующим кодом. Проблема в том, что почему то не отображается иконка. toolbar создаётся, но он как будто пустой, иконка не подгружается.
#!/usr/bin/python

# toolbar.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('toolbar')

self.exit = QtGui.QAction(QtGui.QIcon('icons/exit.png'), 'Exit', self)
self.exit.setShortcut('Ctrl+Q')
self.connect(self.exit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()'))

self.toolbar = self.addToolBar('Exit')
self.toolbar.addAction(self.exit)


app = QtGui.QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec_())
Alen
А файл
'icons/exit.png'
имеется?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB