-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfixedbutton.py
More file actions
40 lines (31 loc) · 944 Bytes
/
Copy pathfixedbutton.py
File metadata and controls
40 lines (31 loc) · 944 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
import sys
from PyQt5.QtWidgets import QWidget, QPushButton, QApplication, QHBoxLayout, QVBoxLayout
class first(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
#Кнопки в нижнем углу
b1=QPushButton('OK',self)
b2=QPushButton('CANCEL',self)
b1.clicked.connect(self.click)
b2.clicked.connect(self.click)
hbox=QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(b1)
hbox.addWidget(b2)
vbox=QVBoxLayout()
vbox.addStretch(1)
vbox.addLayout(hbox)
self.setLayout(vbox)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('UPLe')
self.show()
def click(self):
sender=self.sender()
if sender.text()=='OK':
print('123')
if __name__ == '__main__':
app=QApplication(sys.argv)
x=first()
sys.exit(app.exec_())