-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1023-01-Event sender.py
More file actions
44 lines (31 loc) · 983 Bytes
/
1023-01-Event sender.py
File metadata and controls
44 lines (31 loc) · 983 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/10/23 下午1:43
# @Author : hukezhu
# @Site :
# @File : 1023-01-Event sender.py
# @Software: PyCharm
import sys
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
class Exp(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
btn1 = QPushButton('按钮1',self)
btn1.move(30,50)
btn2 = QPushButton('按钮2',self)
btn2.move(150,50)
btn1.clicked.connect(self.buttonClicked)
btn2.clicked.connect(self.buttonClicked)
self.statusBar()
self.setGeometry(300,300,290,150)
self.setWindowFilePath('Event sender')
self.show()
def buttonClicked(self):
sender = self.sender()
self.statusBar().showMessage(sender.text() + '被点击了')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Exp()
sys.exit(app.exec_())