import sys
from PyQt4 import QtGui, QtCore
if __name__ == "__main__":
i1
= QtGui.
QPixmap('qtg_aircraft.png') i2
= QtGui.
QPixmap('qtg_locked.png')
alpha.fill(QtCore.Qt.transparent)
painter.
setBrush(QtGui.
QBrush(QtCore.
Qt.
NoBrush))
painter.
drawPixmap(QtCore.
QRect(0,
0,
24,
24),
alpha,
QtCore.
QRect(0,
0,
24,
24))
painter.
drawImage(QtCore.
QRect(0,
0,
24,
24),
i1.toImage(),
QtCore.
QRect(0,
0,
24,
24))
painter.
drawImage(QtCore.
QRect(0,
0,
15,
15),
i2.toImage(),
QtCore.
QRect(0,
0,
24,
24))
painter.end()
label.setPixmap(result)
label.show()
sys.exit(app.exec_())
import sys
from PyQt4 import QtGui, QtCore
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
i1 = QtGui.QPixmap('qtg_aircraft.png')
i2 = QtGui.QPixmap('qtg_locked.png')
alpha = QtGui.QPixmap(QtCore.QSize(24, 24))
alpha.fill(QtCore.Qt.transparent)
result = QtGui.QPixmap(QtCore.QSize(24, 24))
painter = QtGui.QPainter(result)
painter.setBrush(QtGui.QBrush(QtCore.Qt.NoBrush))
painter.drawPixmap(QtCore.QRect(0, 0, 24, 24),
alpha,
QtCore.QRect(0, 0, 24, 24))
painter.drawImage(QtCore.QRect(0, 0, 24, 24),
i1.toImage(),
QtCore.QRect(0, 0, 24, 24))
painter.drawImage(QtCore.QRect(0, 0, 15, 15),
i2.toImage(),
QtCore.QRect(0, 0, 24, 24))
painter.end()
label = QtGui.QLabel()
label.setPixmap(result)
label.show()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
Bookmarks