1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| #!/usr/bin/python3 -u
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class caca(QDialog):
def __init__(self, parent=None):
super(caca, self).__init__(parent)
self.Icons = QIcon()
Pix1 = QIcon.fromTheme("format-text-lowercase").pixmap(QSize(16,16))
Pix2 = QIcon.fromTheme("dialog-cancel").pixmap(QSize(16,16))
Pix3 = QIcon.fromTheme("dialog-ok").pixmap(QSize(16,16))
Pix4 = QIcon.fromTheme("journal-new").pixmap(QSize(16,16))
Pix5 = QIcon.fromTheme("view-refresh").pixmap(QSize(16,16))
Pix6 = QIcon.fromTheme("edit-delete").pixmap(QSize(16,16))
Pix7 = QIcon.fromTheme("edit-rename").pixmap(QSize(16,16))
Pix8 = QIcon.fromTheme("journal-new").pixmap(QSize(16,16))
#self.Icons.addPixmap(Pix1, QIcon.Selected, QIcon.On)
#self.Icons.addPixmap(Pix2, QIcon.Disabled, QIcon.On)
self.Icons.addPixmap(Pix3, QIcon.Active, QIcon.On)
#self.Icons.addPixmap(Pix4, QIcon.Normal, QIcon.On)
#self.Icons.addPixmap(Pix5, QIcon.Selected, QIcon.Off)
#self.Icons.addPixmap(Pix6, QIcon.Disabled, QIcon.Off)
self.Icons.addPixmap(Pix7, QIcon.Active, QIcon.Off)
#self.Icons.addPixmap(Pix8, QIcon.Normal, QIcon.Off)
self.IconAction = QAction()
self.IconAction.setCheckable(True)
self.IconAction.setIcon(self.Icons)
self.lineEdit = QLineEdit(self)
self.lineEdit.addAction(self.IconAction, QLineEdit.LeadingPosition)
self.pushButton = QPushButton(self)
self.pushButton.setCheckable(True)
self.pushButton.setIcon(self.Icons)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.addWidget(self.pushButton)
self.verticalLayout.addWidget(self.lineEdit)
self.show()
app = QApplication(sys.argv)
cacaClass = caca()
cacaClass.setAttribute(Qt.WA_DeleteOnClose)
app.exec() |
Partager