(self, *args, **kwargs)
| 25 | class Window(QWidget): |
| 26 | |
| 27 | def __init__(self, *args, **kwargs): |
| 28 | super(Window, self).__init__(*args, **kwargs) |
| 29 | layout = QHBoxLayout(self) |
| 30 | |
| 31 | # 绿色边框 |
| 32 | labelGreen = QLabel(self, pixmap=QPixmap('Data/1.jpg').scaled(100, 100)) |
| 33 | layout.addWidget(labelGreen) |
| 34 | aniGreen = AnimationShadowEffect(Qt.darkGreen, labelGreen) |
| 35 | labelGreen.setGraphicsEffect(aniGreen) |
| 36 | aniGreen.start() |
| 37 | |
| 38 | # 红色边框,圆形图片 |
| 39 | labelRed = QLabel(self) |
| 40 | labelRed.setMinimumSize(100, 100) |
| 41 | labelRed.setMaximumSize(100, 100) |
| 42 | labelRed.setStyleSheet('border-image: url(Data/1.jpg);border-radius: 50px;') |
| 43 | layout.addWidget(labelRed) |
| 44 | aniRed = AnimationShadowEffect(Qt.red, labelGreen) |
| 45 | labelRed.setGraphicsEffect(aniRed) |
| 46 | aniRed.start() |
| 47 | |
| 48 | # 蓝色边框按钮 |
| 49 | button = QPushButton('按钮', self) |
| 50 | aniButton = AnimationShadowEffect(Qt.blue, button) |
| 51 | layout.addWidget(button) |
| 52 | button.setGraphicsEffect(aniButton) |
| 53 | button.clicked.connect(aniButton.stop) # 按下按钮停止动画 |
| 54 | aniButton.start() |
| 55 | |
| 56 | # 青色边框输入框 |
| 57 | lineedit = QLineEdit(self) |
| 58 | aniEdit = AnimationShadowEffect(Qt.cyan, lineedit) |
| 59 | layout.addWidget(lineedit) |
| 60 | lineedit.setGraphicsEffect(aniEdit) |
| 61 | aniEdit.start() |
| 62 | |
| 63 | |
| 64 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected