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
| #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
# python 2.7
import sys, os
from PyQt4 import QtCore, QtGui
#############################################################################
class Fenetre(QtGui.QWidget):
def __init__(self, parent=None):
super(Fenetre,self).__init__(parent)
self.resize(400, 300)
self.label = QtGui.QLabel(self)
image = QtGui.QPixmap(u"monimage.jpg")
image = image.scaledToWidth(200, QtCore.Qt.SmoothTransformation)
self.label.setPixmap(image)
ombre = QtGui.QGraphicsDropShadowEffect(self)
ombre.setBlurRadius(20) # defaut: 1
ombre.setColor(QtGui.QColor(63,63,63, 180)) #defaut: QtGui.QColor(63, 63, 63, 180)
ombre.setOffset(8, 8) # defaut: 8,8
self.label.setGraphicsEffect(ombre)
posit = QtGui.QGridLayout()
posit.addWidget(self.label, 0, 0)
posit.setAlignment(self.label, QtCore.Qt.AlignCenter)
self.setLayout(posit)
#############################################################################
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
fen = Fenetre()
fen.show()
sys.exit(app.exec_()) |
Partager