-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
91 lines (84 loc) · 2.93 KB
/
main.py
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from shop_stock import *
from msale import *
from shop_search import *
class Shopmain(QWidget):
def __init__(self, parent=None):
super(Shopmain, self).__init__(parent)
self.initUI()
#UI窗口设计
def initUI(self):
self.resize(1366,768)
#self.setGeometry(50, 50, 800, 600)
#标题
self.setWindowTitle("药店信息管理系统")
#三个子系统选择按钮,绑定信号事件
btn_main_sale= QPushButton("销售")
btn_main_sale.setFixedSize(200, 45)
btn_main_sale.setStyleSheet("background-color :rgb(253,216,174)")
btn_main_sale.clicked.connect(self.sale)
btn_main_stock = QPushButton("录入")
btn_main_stock.setStyleSheet("background-color :rgb(253,216,174)")
btn_main_stock.setFixedSize(200, 45)
btn_main_stock.clicked.connect(self.stock)
btn_main_search = QPushButton("查询")
btn_main_search.setStyleSheet("background-color :rgb(253,216,174)")
btn_main_search.setFixedSize(200, 45)
btn_main_search.clicked.connect(self.search)
#title
label_main_title = QLabel("药店信息管理系统")
label_main_title.setFont(QFont("华文行楷", 25))
label_main_title.setStyleSheet('''color: rgb(200,10,100);''')
label_main_explain = QLabel(self)
label_main_explain.setText("<a href = '#'>关于本系统</a>")
label_main_explain.linkActivated.connect(self.explain)
labe_null1 = QLabel()
labe_null2 = QLabel()
#布局设计
layout = QVBoxLayout(self)
h1 = QHBoxLayout()
h2 = QHBoxLayout()
h3 = QHBoxLayout()
g1 = QGridLayout()
g2 = QGridLayout()
g3 = QGridLayout()
h1.addWidget(label_main_title, 0, Qt.AlignCenter)
g1.addWidget(labe_null1)
g2.addWidget(btn_main_sale, 1, 0)
g2.addWidget(btn_main_stock, 2, 0)
g2.addWidget(btn_main_search, 3, 0)
g3.addWidget(labe_null2)
h2.addLayout(g1)
h2.addLayout(g2)
h2.addLayout(g3)
h3.addWidget(label_main_explain, 0, Qt.AlignLeft|Qt.AlignBottom)
layout.addLayout(h1)
layout.addLayout(h2)
layout.addLayout(h3)
def explain(self):
pass
def stock(self):
self.stock = Shopstock()
self.stock.show()
def sale(self):
self.sell = MSale()
self.sell.show()
def search(self):
try:
self.search = MSearch()
self.search.show()
except Exception as e:
print(e)
#设置背景图片
def paintEvent(self, event):
painter = QPainter(self)
pixmap = QPixmap("main.jpg")
painter.drawPixmap(self.rect(), pixmap)
if __name__ == "__main__":
app =QApplication(sys.argv)
shop = Shopmain()
shop.show()
sys.exit(app.exec())