-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
63 lines (49 loc) · 1.74 KB
/
Copy pathmain.py
File metadata and controls
63 lines (49 loc) · 1.74 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import sys
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QDesktopWidget, QPushButton, QHBoxLayout, QVBoxLayout, QLabel
from PyQt5.QtGui import QPixmap
class window(QWidget): #QMainWindow
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('ZODZU') #Название окна
q=QDesktopWidget().availableGeometry()
self.setGeometry(0, 0, q.width(), q.height()) #Размеры окна и положение
#Верхняя полоса
p1=QPixmap("icon.png")
t1=QLabel(self)
t1.setPixmap(p1)
t2=QLabel('ZODZU', self) #Надпись
b3=QPushButton('Notes',self)
b3.clicked.connect(self.click)
l1=QHBoxLayout()
l1.addWidget(t1)
l1.addWidget(t2)
l1.addWidget(b3)
l1.addStretch()
#Кнопки в нижнем углу
b1=QPushButton('OK',self)
b2=QPushButton('CANCEL',self)
b1.clicked.connect(self.click)
b2.clicked.connect(self.click)
hbox=QHBoxLayout() #Вертикальный блок
hbox.addStretch() #Бесконечное пустое растяжение
hbox.addWidget(b1)
hbox.addWidget(b2)
vbox=QVBoxLayout()
vbox.addLayout(l1)
vbox.addStretch()
vbox.addLayout(hbox)
self.setLayout(vbox)
def click(self): #Обработка кликов
sender=self.sender()
if sender.text()=='Notes':
t3=QLabel('Note', self)
self.vbox.addWidget(t3)
# self.statusBar().showMessage('123')
if __name__ == '__main__':
app=QApplication(sys.argv)
x=window()
# x2=bar()
x.show()
sys.exit(app.exec_())