1 Star 0 Fork 308

zhangbinchao / PyQt

forked from PyQt5 / PyQt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ShadowEffect.py 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
Irony 提交于 2018-12-28 23:09 . update
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2018年9月25日
@author: Irony
@site: https://pyqt5.com , https://github.com/892768447
@email: 892768447@qq.com
@file: ShadowEffect
@description:
"""
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton, QLineEdit
from Lib.AnimationShadowEffect import AnimationShadowEffect # @UnresolvedImport
__Author__ = """By: Irony
QQ: 892768447
Email: 892768447@qq.com"""
__Copyright__ = 'Copyright (c) 2018 Irony'
__Version__ = 1.0
class Window(QWidget):
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QHBoxLayout(self)
# 绿色边框
labelGreen = QLabel(self, pixmap=QPixmap('Data/1.jpg').scaled(100, 100))
layout.addWidget(labelGreen)
aniGreen = AnimationShadowEffect(Qt.darkGreen, labelGreen)
labelGreen.setGraphicsEffect(aniGreen)
aniGreen.start()
# 红色边框,圆形图片
labelRed = QLabel(self)
labelRed.setMinimumSize(100, 100)
labelRed.setMaximumSize(100, 100)
labelRed.setStyleSheet('border-image: url(Data/1.jpg);border-radius: 50px;')
layout.addWidget(labelRed)
aniRed = AnimationShadowEffect(Qt.red, labelGreen)
labelRed.setGraphicsEffect(aniRed)
aniRed.start()
# 蓝色边框按钮
button = QPushButton('按钮', self)
aniButton = AnimationShadowEffect(Qt.blue, button)
layout.addWidget(button)
button.setGraphicsEffect(aniButton)
button.clicked.connect(aniButton.stop) # 按下按钮停止动画
aniButton.start()
# 青色边框输入框
lineedit = QLineEdit(self)
aniEdit = AnimationShadowEffect(Qt.cyan, lineedit)
layout.addWidget(lineedit)
lineedit.setGraphicsEffect(aniEdit)
aniEdit.start()
if __name__ == '__main__':
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
w = Window()
w.show()
sys.exit(app.exec_())
Python
1
https://gitee.com/zhangbinchao/PyQt.git
git@gitee.com:zhangbinchao/PyQt.git
zhangbinchao
PyQt
PyQt
master

搜索帮助