基于pyqt5开发的图书管理系统UI(带登录页面)

这篇具有很好参考价值的文章主要介绍了基于pyqt5开发的图书管理系统UI(带登录页面)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

由于老师布置了关于图书馆UI界面的开发任务,因此做了这个UI界面,因为老师说用C#开发,而自己也不会,使用就pyqt去实现,希望这个UI界面对各位小伙伴有些帮助。UI主要是使用的designer去设计的,然后进行了界面的美化,对于里面的功能目前也只做了天气的,但是因为这个接口失效了,使用就一直是loading。

pyqt5图书管理系统,ui,qt,python

pyqt5图书管理系统,ui,qt,python

对于UI的代码中自己也加入了许多的图标,第一次做UI的设计也参考了许多的模板,也反反复复修改了很多次,特别最难受的是网上对这些图标都找不到,特别是放大缩小这种,很多都不是自己想要的效果,然后就发现了一个图标的网站,而且质量比较高【iconfont】,然后因为直接做的UI,所以需要加入函数才能实现对窗口的拖动:

    def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton and self.isMaximized() == False:
            self.m_flag = True
            self.m_Position = event.globalPos() - self.pos()  # 获取鼠标相对窗口的位置
            event.accept()
            self.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))  # 更改鼠标图标

    def mouseMoveEvent(self, mouse_event):
        if QtCore.Qt.LeftButton and self.m_flag:
            self.move(mouse_event.globalPos() - self.m_Position)  # 更改窗口位置
            mouse_event.accept()

    def mouseReleaseEvent(self, mouse_event):
        self.m_flag = False
        self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))

这个呢,也是去B站学习,然后up主给的代码。

主页UI代码:

对于主页的代码呢,因为我这也是第二次做UI,以前用过tkinter做ui,它的话就没有使用可视化的编辑。这个pyqt5使用的designer,感觉的确很方便。然后它里面的更改样式表是叫QSS,跟这个CCS很相似,大家可以找一些关于它的资料,对你自己做UI的美化还是很有帮助的。

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'homepage.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow2(object):
    def setupUi(self, MainWindow2):
        MainWindow2.setObjectName("MainWindow2")
        MainWindow2.resize(1206, 860)
        self.centralwidget = QtWidgets.QWidget(MainWindow2)
        self.centralwidget.setObjectName("centralwidget")
        self.frame_13 = QtWidgets.QFrame(self.centralwidget)
        self.frame_13.setGeometry(QtCore.QRect(90, 40, 991, 671))
        self.frame_13.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_13.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_13.setObjectName("frame_13")
        self.frame_3 = QtWidgets.QFrame(self.frame_13)
        self.frame_3.setGeometry(QtCore.QRect(0, 0, 201, 671))
        self.frame_3.setStyleSheet("background-color: rgb(102,122,255);\n"
"\n"
"\n"
"")
        self.frame_3.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_3.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_3.setObjectName("frame_3")
        self.frame_11 = QtWidgets.QFrame(self.frame_3)
        self.frame_11.setGeometry(QtCore.QRect(0, 100, 201, 61))
        self.frame_11.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_11.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_11.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_11.setObjectName("frame_11")
        self.pushButton_5 = QtWidgets.QPushButton(self.frame_11)
        self.pushButton_5.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_5.setFont(font)
        self.pushButton_5.setStyleSheet("QPushButton{\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    background-image: url(:/image/png/主页 .png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(102,122,255);\n"
"    background-image: url(:/image/png/主页 (2).png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/png/png/主页.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_5.setIcon(icon)
        self.pushButton_5.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_5.setObjectName("pushButton_5")
        self.frame_12 = QtWidgets.QFrame(self.frame_3)
        self.frame_12.setGeometry(QtCore.QRect(0, 190, 201, 61))
        self.frame_12.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_12.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_12.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_12.setObjectName("frame_12")
        self.pushButton_20 = QtWidgets.QPushButton(self.frame_12)
        self.pushButton_20.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_20.setFont(font)
        self.pushButton_20.setStyleSheet("QPushButton{\n"
"    \n"
"    background-image: url(:/image/png/图书馆 (1).png);\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(102,122,255);\n"
"    \n"
"    background-image: url(:/image/png/图书馆.png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"\n"
"")
        self.pushButton_20.setIcon(icon)
        self.pushButton_20.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_20.setObjectName("pushButton_20")
        self.frame_14 = QtWidgets.QFrame(self.frame_3)
        self.frame_14.setGeometry(QtCore.QRect(0, 280, 201, 61))
        self.frame_14.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_14.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_14.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_14.setObjectName("frame_14")
        self.pushButton_16 = QtWidgets.QPushButton(self.frame_14)
        self.pushButton_16.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_16.setFont(font)
        self.pushButton_16.setStyleSheet("QPushButton{\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    \n"
"    background-image: url(:/image/png/图书期刊.png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(102,122,255);\n"
"    \n"
"    background-image: url(:/image/png/图书期刊 (1).png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"\n"
"")
        self.pushButton_16.setIcon(icon)
        self.pushButton_16.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_16.setObjectName("pushButton_16")
        self.frame_15 = QtWidgets.QFrame(self.frame_3)
        self.frame_15.setGeometry(QtCore.QRect(0, 370, 201, 61))
        self.frame_15.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_15.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_15.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_15.setObjectName("frame_15")
        self.pushButton_17 = QtWidgets.QPushButton(self.frame_15)
        self.pushButton_17.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_17.setFont(font)
        self.pushButton_17.setStyleSheet("QPushButton{\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    \n"
"    background-image: url(:/image/png/借阅管理 (1).png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(102,122,255);\n"
"    \n"
"    background-image: url(:/image/png/借阅管理.png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"")
        self.pushButton_17.setIcon(icon)
        self.pushButton_17.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_17.setObjectName("pushButton_17")
        self.frame_16 = QtWidgets.QFrame(self.frame_3)
        self.frame_16.setGeometry(QtCore.QRect(0, 460, 201, 61))
        self.frame_16.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_16.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_16.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_16.setObjectName("frame_16")
        self.pushButton_18 = QtWidgets.QPushButton(self.frame_16)
        self.pushButton_18.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_18.setFont(font)
        self.pushButton_18.setStyleSheet("QPushButton{\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    \n"
"    background-image: url(:/image/png/读者管理.png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(102,122,255);\n"
"    \n"
"    background-image: url(:/image/png/读者管理 (1).png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"\n"
"")
        self.pushButton_18.setIcon(icon)
        self.pushButton_18.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_18.setObjectName("pushButton_18")
        self.frame_17 = QtWidgets.QFrame(self.frame_3)
        self.frame_17.setGeometry(QtCore.QRect(0, 610, 201, 61))
        self.frame_17.setStyleSheet("QPushButton{\n"
"background-color: rgb(94,112,232);\n"
"}\n"
"QPushButton:hover{\n"
"background-color: rgb(255, 255, 255);\n"
"\n"
"}")
        self.frame_17.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_17.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_17.setObjectName("frame_17")
        self.pushButton_19 = QtWidgets.QPushButton(self.frame_17)
        self.pushButton_19.setGeometry(QtCore.QRect(-100, 0, 301, 61))
        self.pushButton_19.setStyleSheet("QPushButton{\n"
"    border:none;\n"
"    color: rgb(255, 255, 255);\n"
"    background-image: url(:/image/png/退出 (2).png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"QPushButton:hover{\n"
"    color: rgb(94,112,232);\n"
"    \n"
"    background-image: url(:/image/png/退出 .png);\n"
"    background-position:  center;\n"
"    background-repeat: no-repeat;\n"
"    padding-left:125px\n"
"}\n"
"\n"
"")
        self.pushButton_19.setIcon(icon)
        self.pushButton_19.setIconSize(QtCore.QSize(25, 25))
        self.pushButton_19.setObjectName("pushButton_19")
        self.frame = QtWidgets.QFrame(self.frame_13)
        self.frame.setGeometry(QtCore.QRect(200, 0, 791, 51))
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.label_19 = QtWidgets.QLabel(self.frame)
        self.label_19.setGeometry(QtCore.QRect(0, 0, 801, 41))
        self.label_19.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_19.setText("")
        self.label_19.setObjectName("label_19")
        self.frame_18 = QtWidgets.QFrame(self.frame_13)
        self.frame_18.setGeometry(QtCore.QRect(200, 40, 801, 721))
        self.frame_18.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_18.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_18.setObjectName("frame_18")
        self.stackedWidget = QtWidgets.QStackedWidget(self.frame_18)
        self.stackedWidget.setGeometry(QtCore.QRect(-1, 0, 801, 641))
        self.stackedWidget.setObjectName("stackedWidget")
        self.page = QtWidgets.QWidget()
        self.page.setObjectName("page")
        self.label = QtWidgets.QLabel(self.page)
        self.label.setGeometry(QtCore.QRect(0, -10, 801, 641))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)
        self.label.setMinimumSize(QtCore.QSize(10, 0))
        font = QtGui.QFont()
        font.setFamily("汉仪长仿宋体")
        self.label.setFont(font)
        self.label.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label.setText("")
        self.label.setObjectName("label")
        self.frame_5 = QtWidgets.QFrame(self.page)
        self.frame_5.setGeometry(QtCore.QRect(0, 0, 791, 161))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_5.sizePolicy().hasHeightForWidth())
        self.frame_5.setSizePolicy(sizePolicy)
        self.frame_5.setStyleSheet("border-top-left-radius:8px;\n"
"border-bottom-left-radius:8px;\n"
"border-top-right-radius:8px;\n"
"border-bottom-right-radius:8px;\n"
"")
        self.frame_5.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_5.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_5.setObjectName("frame_5")
        self.label_6 = QtWidgets.QLabel(self.frame_5)
        self.label_6.setGeometry(QtCore.QRect(30, 10, 171, 121))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
        self.label_6.setSizePolicy(sizePolicy)
        self.label_6.setMinimumSize(QtCore.QSize(10, 0))
        self.label_6.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0.739559, y1:0.233, x2:1, y2:0, stop:0 rgba(95, 95, 255, 255), stop:1 rgba(255, 255, 255, 255));\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_6.setText("")
        self.label_6.setObjectName("label_6")
        self.label_20 = QtWidgets.QLabel(self.frame_5)
        self.label_20.setGeometry(QtCore.QRect(220, 10, 171, 121))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_20.sizePolicy().hasHeightForWidth())
        self.label_20.setSizePolicy(sizePolicy)
        self.label_20.setMinimumSize(QtCore.QSize(10, 0))
        font = QtGui.QFont()
        font.setPointSize(11)
        self.label_20.setFont(font)
        self.label_20.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0.759905, y1:0.261, x2:1, y2:0, stop:0 rgba(109, 193, 25, 255), stop:1 rgba(255, 255, 255, 255));\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_20.setText("")
        self.label_20.setObjectName("label_20")
        self.label_21 = QtWidgets.QLabel(self.frame_5)
        self.label_21.setGeometry(QtCore.QRect(410, 10, 171, 121))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_21.sizePolicy().hasHeightForWidth())
        self.label_21.setSizePolicy(sizePolicy)
        self.label_21.setMinimumSize(QtCore.QSize(10, 0))
        self.label_21.setStyleSheet("\n"
"background-color: qlineargradient(spread:pad, x1:0.765732, y1:0.25, x2:1, y2:0, stop:0 rgba(142, 142, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_21.setText("")
        self.label_21.setObjectName("label_21")
        self.label_22 = QtWidgets.QLabel(self.frame_5)
        self.label_22.setGeometry(QtCore.QRect(600, 10, 171, 121))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_22.sizePolicy().hasHeightForWidth())
        self.label_22.setSizePolicy(sizePolicy)
        self.label_22.setMinimumSize(QtCore.QSize(10, 0))
        self.label_22.setStyleSheet("background-color: qlineargradient(spread:pad, x1:0.725799, y1:0.239, x2:1, y2:0, stop:0 rgba(255, 181, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_22.setText("")
        self.label_22.setObjectName("label_22")
        self.label_23 = QtWidgets.QLabel(self.frame_5)
        self.label_23.setGeometry(QtCore.QRect(40, 20, 81, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_23.setFont(font)
        self.label_23.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_23.setObjectName("label_23")
        self.label_24 = QtWidgets.QLabel(self.frame_5)
        self.label_24.setGeometry(QtCore.QRect(230, 20, 81, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_24.setFont(font)
        self.label_24.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_24.setObjectName("label_24")
        self.label_25 = QtWidgets.QLabel(self.frame_5)
        self.label_25.setGeometry(QtCore.QRect(420, 20, 81, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_25.setFont(font)
        self.label_25.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_25.setObjectName("label_25")
        self.label_26 = QtWidgets.QLabel(self.frame_5)
        self.label_26.setGeometry(QtCore.QRect(610, 20, 81, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_26.setFont(font)
        self.label_26.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_26.setObjectName("label_26")
        self.pushButton_3 = QtWidgets.QPushButton(self.frame_5)
        self.pushButton_3.setGeometry(QtCore.QRect(150, 20, 51, 21))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(9)
        self.pushButton_3.setFont(font)
        self.pushButton_3.setStyleSheet("color: rgb(255, 255, 255);")
        self.pushButton_3.setObjectName("pushButton_3")
        self.pushButton_4 = QtWidgets.QPushButton(self.frame_5)
        self.pushButton_4.setGeometry(QtCore.QRect(340, 20, 51, 21))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(9)
        self.pushButton_4.setFont(font)
        self.pushButton_4.setStyleSheet("color: rgb(255, 255, 255);")
        self.pushButton_4.setObjectName("pushButton_4")
        self.pushButton_6 = QtWidgets.QPushButton(self.frame_5)
        self.pushButton_6.setGeometry(QtCore.QRect(530, 20, 51, 21))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(9)
        self.pushButton_6.setFont(font)
        self.pushButton_6.setStyleSheet("color: rgb(255, 255, 255);")
        self.pushButton_6.setObjectName("pushButton_6")
        self.pushButton_7 = QtWidgets.QPushButton(self.frame_5)
        self.pushButton_7.setGeometry(QtCore.QRect(720, 20, 51, 21))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(9)
        self.pushButton_7.setFont(font)
        self.pushButton_7.setStyleSheet("color: rgb(255, 255, 255);")
        self.pushButton_7.setObjectName("pushButton_7")
        self.label_27 = QtWidgets.QLabel(self.frame_5)
        self.label_27.setGeometry(QtCore.QRect(80, 70, 71, 41))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(23)
        self.label_27.setFont(font)
        self.label_27.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_27.setObjectName("label_27")
        self.label_28 = QtWidgets.QLabel(self.frame_5)
        self.label_28.setGeometry(QtCore.QRect(150, 90, 21, 16))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_28.setFont(font)
        self.label_28.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_28.setObjectName("label_28")
        self.label_29 = QtWidgets.QLabel(self.frame_5)
        self.label_29.setGeometry(QtCore.QRect(270, 70, 71, 41))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(23)
        self.label_29.setFont(font)
        self.label_29.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_29.setObjectName("label_29")
        self.label_30 = QtWidgets.QLabel(self.frame_5)
        self.label_30.setGeometry(QtCore.QRect(340, 90, 21, 16))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_30.setFont(font)
        self.label_30.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_30.setObjectName("label_30")
        self.label_31 = QtWidgets.QLabel(self.frame_5)
        self.label_31.setGeometry(QtCore.QRect(460, 70, 71, 41))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(23)
        self.label_31.setFont(font)
        self.label_31.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_31.setObjectName("label_31")
        self.label_32 = QtWidgets.QLabel(self.frame_5)
        self.label_32.setGeometry(QtCore.QRect(530, 90, 21, 16))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_32.setFont(font)
        self.label_32.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_32.setObjectName("label_32")
        self.label_33 = QtWidgets.QLabel(self.frame_5)
        self.label_33.setGeometry(QtCore.QRect(650, 70, 71, 41))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(23)
        self.label_33.setFont(font)
        self.label_33.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_33.setObjectName("label_33")
        self.label_34 = QtWidgets.QLabel(self.frame_5)
        self.label_34.setGeometry(QtCore.QRect(720, 90, 21, 16))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_34.setFont(font)
        self.label_34.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_34.setObjectName("label_34")
        self.label_35 = QtWidgets.QLabel(self.page)
        self.label_35.setGeometry(QtCore.QRect(30, 170, 361, 211))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_35.sizePolicy().hasHeightForWidth())
        self.label_35.setSizePolicy(sizePolicy)
        self.label_35.setMinimumSize(QtCore.QSize(10, 0))
        self.label_35.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_35.setText("")
        self.label_35.setObjectName("label_35")
        self.label_36 = QtWidgets.QLabel(self.page)
        self.label_36.setGeometry(QtCore.QRect(410, 170, 361, 311))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_36.sizePolicy().hasHeightForWidth())
        self.label_36.setSizePolicy(sizePolicy)
        self.label_36.setMinimumSize(QtCore.QSize(10, 0))
        self.label_36.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_36.setText("")
        self.label_36.setObjectName("label_36")
        self.label_37 = QtWidgets.QLabel(self.page)
        self.label_37.setGeometry(QtCore.QRect(30, 400, 361, 211))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_37.sizePolicy().hasHeightForWidth())
        self.label_37.setSizePolicy(sizePolicy)
        self.label_37.setMinimumSize(QtCore.QSize(10, 0))
        self.label_37.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);\n"
"")
        self.label_37.setText("")
        self.label_37.setObjectName("label_37")
        self.label_38 = QtWidgets.QLabel(self.page)
        self.label_38.setGeometry(QtCore.QRect(50, 190, 101, 16))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_38.setFont(font)
        self.label_38.setObjectName("label_38")
        self.label_39 = QtWidgets.QLabel(self.page)
        self.label_39.setGeometry(QtCore.QRect(430, 190, 72, 15))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_39.setFont(font)
        self.label_39.setObjectName("label_39")
        self.label_40 = QtWidgets.QLabel(self.page)
        self.label_40.setGeometry(QtCore.QRect(50, 420, 72, 15))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_40.setFont(font)
        self.label_40.setObjectName("label_40")
        self.label_42 = QtWidgets.QLabel(self.page)
        self.label_42.setGeometry(QtCore.QRect(90, 480, 72, 15))
        self.label_42.setText("")
        self.label_42.setObjectName("label_42")
        self.frame_6 = QtWidgets.QFrame(self.page)
        self.frame_6.setGeometry(QtCore.QRect(410, 489, 361, 131))
        self.frame_6.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_6.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_6.setObjectName("frame_6")
        self.label_41 = QtWidgets.QLabel(self.frame_6)
        self.label_41.setGeometry(QtCore.QRect(0, 0, 361, 121))
        self.label_41.setStyleSheet("border-style: solid;\n"
"border-width: 2px;\n"
"border-color:  rgb(0, 0, 0 ,10);")
        self.label_41.setText("")
        self.label_41.setObjectName("label_41")
        self.frame_19 = QtWidgets.QFrame(self.frame_6)
        self.frame_19.setGeometry(QtCore.QRect(0, -10, 361, 71))
        self.frame_19.setStyleSheet("")
        self.frame_19.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_19.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_19.setObjectName("frame_19")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.frame_19)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label_9 = QtWidgets.QLabel(self.frame_19)
        self.label_9.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-image: url(:/image/images/地区管理.png);\n"
"\n"
"border-radius:9px;\n"
"")
        self.label_9.setText("")
        self.label_9.setObjectName("label_9")
        self.horizontalLayout_3.addWidget(self.label_9)
        self.label_14 = QtWidgets.QLabel(self.frame_19)
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_14.setFont(font)
        self.label_14.setObjectName("label_14")
        self.horizontalLayout_3.addWidget(self.label_14)
        self.label_18 = QtWidgets.QLabel(self.frame_19)
        self.label_18.setObjectName("label_18")
        self.horizontalLayout_3.addWidget(self.label_18)
        self.label_10 = QtWidgets.QLabel(self.frame_19)
        self.label_10.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-image: url(:/image/images/天气 (1).png);\n"
"border-radius:9px;\n"
"")
        self.label_10.setText("")
        self.label_10.setObjectName("label_10")
        self.horizontalLayout_3.addWidget(self.label_10)
        self.label_11 = QtWidgets.QLabel(self.frame_19)
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_11.setFont(font)
        self.label_11.setObjectName("label_11")
        self.horizontalLayout_3.addWidget(self.label_11)
        self.label_15 = QtWidgets.QLabel(self.frame_19)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.label_15.setFont(font)
        self.label_15.setObjectName("label_15")
        self.horizontalLayout_3.addWidget(self.label_15)
        self.frame_20 = QtWidgets.QFrame(self.frame_6)
        self.frame_20.setGeometry(QtCore.QRect(0, 60, 361, 71))
        self.frame_20.setStyleSheet("")
        self.frame_20.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_20.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_20.setObjectName("frame_20")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.frame_20)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label_7 = QtWidgets.QLabel(self.frame_20)
        self.label_7.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-radius:9px;\n"
"border-image: url(:/image/images/温度.png);")
        self.label_7.setText("")
        self.label_7.setObjectName("label_7")
        self.horizontalLayout_4.addWidget(self.label_7)
        self.label_12 = QtWidgets.QLabel(self.frame_20)
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_12.setFont(font)
        self.label_12.setObjectName("label_12")
        self.horizontalLayout_4.addWidget(self.label_12)
        self.label_16 = QtWidgets.QLabel(self.frame_20)
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        self.label_16.setFont(font)
        self.label_16.setObjectName("label_16")
        self.horizontalLayout_4.addWidget(self.label_16)
        self.label_8 = QtWidgets.QLabel(self.frame_20)
        self.label_8.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border-image: url(:/image/images/湿度 (1).png);\n"
"border-radius:9px;\n"
"")
        self.label_8.setText("")
        self.label_8.setObjectName("label_8")
        self.horizontalLayout_4.addWidget(self.label_8)
        self.label_13 = QtWidgets.QLabel(self.frame_20)
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        font.setBold(True)
        font.setWeight(75)
        self.label_13.setFont(font)
        self.label_13.setObjectName("label_13")
        self.horizontalLayout_4.addWidget(self.label_13)
        self.label_17 = QtWidgets.QLabel(self.frame_20)
        self.label_17.setObjectName("label_17")
        self.horizontalLayout_4.addWidget(self.label_17)
        self.stackedWidget.addWidget(self.page)
        self.page_2 = QtWidgets.QWidget()
        self.page_2.setObjectName("page_2")
        self.label_3 = QtWidgets.QLabel(self.page_2)
        self.label_3.setGeometry(QtCore.QRect(1, -6, 791, 641))
        self.label_3.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.label_3.setText("")
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.page_2)
        self.label_4.setGeometry(QtCore.QRect(130, 220, 201, 101))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.stackedWidget.addWidget(self.page_2)
        self.frame_2 = QtWidgets.QFrame(self.centralwidget)
        self.frame_2.setGeometry(QtCore.QRect(290, 40, 741, 41))
        self.frame_2.setStyleSheet("border-top-left-radius:8px;\n"
"border-bottom-left-radius:8px;\n"
"border-top-right-radius:8px;\n"
"border-bottom-right-radius:8px;\n"
"")
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_2.setObjectName("frame_2")
        self.label_2 = QtWidgets.QLabel(self.frame_2)
        self.label_2.setGeometry(QtCore.QRect(9, 9, 131, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.lineEdit = QtWidgets.QLineEdit(self.frame_2)
        self.lineEdit.setGeometry(QtCore.QRect(510, 10, 221, 25))
        self.lineEdit.setMaximumSize(QtCore.QSize(355, 30))
        self.lineEdit.setSizeIncrement(QtCore.QSize(300, 255))
        font = QtGui.QFont()
        font.setFamily("华文楷体")
        self.lineEdit.setFont(font)
        self.lineEdit.setStyleSheet("border-radius:10px;\n"
"background-color: rgb(0, 0, 0 ,50);\n"
"color: rgb(255, 255, 255);\n"
"padding-left:7px\n"
"")
        self.lineEdit.setObjectName("lineEdit")
        self.label_5 = QtWidgets.QLabel(self.frame_2)
        self.label_5.setGeometry(QtCore.QRect(180, 9, 151, 31))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setBold(False)
        font.setWeight(50)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.pushButton = QtWidgets.QPushButton(self.frame_2)
        self.pushButton.setGeometry(QtCore.QRect(700, 10, 31, 31))
        self.pushButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/image/png/搜索.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon1)
        self.pushButton.setObjectName("pushButton")
        self.frame_4 = QtWidgets.QFrame(self.centralwidget)
        self.frame_4.setGeometry(QtCore.QRect(1030, 40, 51, 41))
        self.frame_4.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"padding-bottom:5px;\n"
"}")
        self.frame_4.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_4.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_4.setObjectName("frame_4")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame_4)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.pushButton_2 = QtWidgets.QPushButton(self.frame_4)
        self.pushButton_2.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/image/icons/zxh.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon2)
        self.pushButton_2.setIconSize(QtCore.QSize(30, 30))
        self.pushButton_2.setObjectName("pushButton_2")
        self.horizontalLayout.addWidget(self.pushButton_2)
        MainWindow2.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow2)
        self.statusbar.setObjectName("statusbar")
        MainWindow2.setStatusBar(self.statusbar)
        self.menubar = QtWidgets.QMenuBar(MainWindow2)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1206, 23))
        self.menubar.setObjectName("menubar")
        MainWindow2.setMenuBar(self.menubar)

        self.retranslateUi(MainWindow2)
        self.stackedWidget.setCurrentIndex(0)
        self.pushButton_19.clicked.connect(MainWindow2.close) # type: ignore
        self.pushButton_2.clicked.connect(MainWindow2.showMinimized) # type: ignore
        QtCore.QMetaObject.connectSlotsByName(MainWindow2)

    def retranslateUi(self, MainWindow2):
        _translate = QtCore.QCoreApplication.translate
        MainWindow2.setWindowTitle(_translate("MainWindow2", "MainWindow"))
        self.pushButton_5.setText(_translate("MainWindow2", "首页"))
        self.pushButton_20.setText(_translate("MainWindow2", "图书管理"))
        self.pushButton_16.setText(_translate("MainWindow2", "期刊管理"))
        self.pushButton_17.setText(_translate("MainWindow2", "借阅管理"))
        self.pushButton_18.setText(_translate("MainWindow2", "读者管理"))
        self.pushButton_19.setText(_translate("MainWindow2", "离开"))
        self.label_23.setText(_translate("MainWindow2", "借出总量"))
        self.label_24.setText(_translate("MainWindow2", "7天内到期"))
        self.label_25.setText(_translate("MainWindow2", "逾期总量"))
        self.label_26.setText(_translate("MainWindow2", "疑似丢失"))
        self.pushButton_3.setText(_translate("MainWindow2", "MORE"))
        self.pushButton_4.setText(_translate("MainWindow2", "MORE"))
        self.pushButton_6.setText(_translate("MainWindow2", "MORE"))
        self.pushButton_7.setText(_translate("MainWindow2", "MORE"))
        self.label_27.setText(_translate("MainWindow2", "2022"))
        self.label_28.setText(_translate("MainWindow2", "本"))
        self.label_29.setText(_translate("MainWindow2", "2022"))
        self.label_30.setText(_translate("MainWindow2", "本"))
        self.label_31.setText(_translate("MainWindow2", "2022"))
        self.label_32.setText(_translate("MainWindow2", "本"))
        self.label_33.setText(_translate("MainWindow2", "2022"))
        self.label_34.setText(_translate("MainWindow2", "本"))
        self.label_38.setText(_translate("MainWindow2", "今日公告"))
        self.label_39.setText(_translate("MainWindow2", "读者荐读"))
        self.label_40.setText(_translate("MainWindow2", "今日预约"))
        self.label_14.setText(_translate("MainWindow2", "城市"))
        self.label_18.setText(_translate("MainWindow2", "loading"))
        self.label_11.setText(_translate("MainWindow2", "天气"))
        self.label_15.setText(_translate("MainWindow2", "loading"))
        self.label_12.setText(_translate("MainWindow2", "温度"))
        self.label_16.setText(_translate("MainWindow2", "loading"))
        self.label_13.setText(_translate("MainWindow2", "湿度"))
        self.label_17.setText(_translate("MainWindow2", "loading"))
        self.label_4.setText(_translate("MainWindow2", "图书管理"))
        self.label_2.setText(_translate("MainWindow2", "2022年09月13日"))
        self.lineEdit.setPlaceholderText(_translate("MainWindow2", "图书、期刊、读者"))
        self.label_5.setText(_translate("MainWindow2", "本月新增加读者 99人"))
import res2_rc

登录UI代码:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'login.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(970, 667)
        font = QtGui.QFont()
        font.setFamily("华文琥珀")
        font.setPointSize(7)
        font.setBold(False)
        font.setWeight(50)
        MainWindow.setFont(font)
        MainWindow.setDockOptions(QtWidgets.QMainWindow.AnimatedDocks)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(200, 110, 151, 351))
        self.label.setStyleSheet("\n"
"background-color: rgb(255, 255, 255);\n"
"")
        self.label.setText("")
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(350, 110, 461, 351))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setStyleSheet("background-image: url(:/images/images/22222 (1).jpg);\n"
"")
        self.label_2.setText("")
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(260, 150, 121, 51))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(17)
        font.setBold(True)
        font.setUnderline(False)
        font.setWeight(75)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.lineEdit_1 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_1.setGeometry(QtCore.QRect(220, 220, 191, 41))
        font = QtGui.QFont()
        font.setFamily("黑体")
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.lineEdit_1.setFont(font)
        self.lineEdit_1.setStyleSheet("border:1px solid rgb(0,0,0);\n"
"border-radius:7px;")
        self.lineEdit_1.setObjectName("lineEdit_1")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(220, 290, 191, 41))
        font = QtGui.QFont()
        font.setFamily("黑体")
        font.setPointSize(10)
        self.lineEdit_2.setFont(font)
        self.lineEdit_2.setStyleSheet("border:1px solid rgb(0,0,0);\n"
"border-radius:7px;")
        self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
        self.lineEdit_2.setCursorMoveStyle(QtCore.Qt.LogicalMoveStyle)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(270, 370, 91, 41))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setStyleSheet("QPushButton:pressed{\n"
"    padding-left:5px;\n"
"    background-color: rgb(170, 255, 255);\n"
"    padding-top:5px;\n"
"    border-radius:7px;\n"
"}\n"
"QPushButton{\n"
"    border:none;\n"
"    background-color: rgb(89, 198, 229);\n"
"    border-radius:7px;\n"
"}\n"
"")
        self.pushButton.setObjectName("pushButton")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(350, 340, 91, 16))
        font = QtGui.QFont()
        font.setFamily("幼圆")
        font.setPointSize(7)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(590, 340, 121, 41))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(670, 380, 111, 31))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.frame_2 = QtWidgets.QFrame(self.centralwidget)
        self.frame_2.setGeometry(QtCore.QRect(200, 110, 611, 351))
        self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_2.setObjectName("frame_2")
        self.frame = QtWidgets.QFrame(self.centralwidget)
        self.frame.setGeometry(QtCore.QRect(740, 100, 79, 44))
        self.frame.setStyleSheet("QPushButton{\n"
"border:none;\n"
"}\n"
"QPushButton:hover{\n"
"padding-bottom:5px;\n"
"}")
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setObjectName("frame")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.pushButton_2 = QtWidgets.QPushButton(self.frame)
        self.pushButton_2.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/icons/zxh.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_2.setIcon(icon)
        self.pushButton_2.setObjectName("pushButton_2")
        self.horizontalLayout.addWidget(self.pushButton_2)
        self.pushButton_3 = QtWidgets.QPushButton(self.frame)
        self.pushButton_3.setStyleSheet("")
        self.pushButton_3.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/icons/gb.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton_3.setIcon(icon1)
        self.pushButton_3.setObjectName("pushButton_3")
        self.horizontalLayout.addWidget(self.pushButton_3)
        self.frame_2.raise_()
        self.label.raise_()
        self.label_2.raise_()
        self.label_3.raise_()
        self.lineEdit_1.raise_()
        self.lineEdit_2.raise_()
        self.pushButton.raise_()
        self.label_4.raise_()
        self.label_5.raise_()
        self.label_6.raise_()
        self.frame.raise_()
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.pushButton_3.clicked.connect(MainWindow.close) # type: ignore
        self.pushButton_2.clicked.connect(MainWindow.showMinimized) # type: ignore
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_3.setText(_translate("MainWindow", "欢迎登录"))
        self.lineEdit_1.setPlaceholderText(_translate("MainWindow", "账号:"))
        self.lineEdit_2.setPlaceholderText(_translate("MainWindow", "密码:"))
        self.pushButton.setText(_translate("MainWindow", "登录"))
        self.label_4.setText(_translate("MainWindow", "忘记密码?"))
        self.label_5.setText(_translate("MainWindow", "团结一条心,"))
        self.label_6.setText(_translate("MainWindow", "石头变成金"))
import res_rc

主函数代码:

主函数里面我觉得没有什么重要的代码,唯一的就是这个跳转页面的代码:

self.ui.pushButton_20.clicked.connect(lambda: self.ui.stackedWidget.setCurrentIndex(1))
self.ui.pushButton_5.clicked.connect(lambda: self.ui.stackedWidget.setCurrentIndex(0))

0代表的是stacked widget的第一个界面,我觉得重点在于,编辑页面的时候把模块的名字备注好,防止UI文件失效了,不知道想使用的模块名是哪一个。

#coding:utf-8
from login import *
from homepage import *
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
import threading
import requests
import time

class loginWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.ui.pushButton.clicked.connect(self.go_to_login)
        self.show()
    def go_to_login(self):
        account = self.ui.lineEdit_1.text()
        password =self.ui.lineEdit_2.text()
        if account == "2020005321" and password == "635217fjl":
            homepageWindow()
            self.close()
        else:
            pass

    #拖动
    def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton and self.isMaximized() == False:
            self.m_flag = True
            self.m_Position = event.globalPos() - self.pos()  # 获取鼠标相对窗口的位置
            event.accept()
            self.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))  # 更改鼠标图标

    def mouseMoveEvent(self, mouse_event):
        if QtCore.Qt.LeftButton and self.m_flag:
            self.move(mouse_event.globalPos() - self.m_Position)  # 更改窗口位置
            mouse_event.accept()

    def mouseReleaseEvent(self, mouse_event):
        self.m_flag = False
        self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))

class homepageWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow2()
        self.ui.setupUi(self)
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.ui.pushButton_20.clicked.connect(lambda: self.ui.stackedWidget.setCurrentIndex(1))
        self.ui.pushButton_5.clicked.connect(lambda: self.ui.stackedWidget.setCurrentIndex(0))
        self.show()
        #self.weather()



    def mousePressEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton and self.isMaximized() == False:
            self.m_flag = True
            self.m_Position = event.globalPos() - self.pos()  # 获取鼠标相对窗口的位置
            event.accept()
            self.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))  # 更改鼠标图标

    def mouseMoveEvent(self, mouse_event):
        if QtCore.Qt.LeftButton and self.m_flag:
            self.move(mouse_event.globalPos() - self.m_Position)  # 更改窗口位置
            mouse_event.accept()

    def mouseReleaseEvent(self, mouse_event):
        self.m_flag = False
        self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))

    def weather(self):  # 天气接口API
        url = 'https://www.tianqiapi.com/api?version=v6&appid=21375891&appsecret=fTYv7v5E&city=重庆'
        res = requests.post(url)
        print(res.json())
        if res.status_code == 200:
            self.ui.label_18.setText(res.json()['city'])
            self.ui.label_15.setText(res.json()['wea'])
            self.ui.label_16.setText(res.json()['tem']+'℃')
            self.ui.label_17.setText(res.json()['humidity'])
        else:
            self.ui.label_18.setText('加载中')
            self.ui.label_15.setText('加载中')
            self.ui.label_16.setText('加载中')
            self.ui.label_17.setText('加载中')

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = loginWindow()
    sys.exit(app.exec_())

目前还不是很完善,只是实现了UI界面,后面具体功能做完了,也会分享给大家。我自己也是第一次做,有不足的地方,请各位大佬多多提建议。文章来源地址https://www.toymoban.com/news/detail-517197.html

到了这里,关于基于pyqt5开发的图书管理系统UI(带登录页面)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 基于Python的图书馆管理系统的开发

    开发工具: python3.10 数据库: Python内置的SQLite3数据库,SQLite是一种嵌入式数据库,体积很小,它的数据库就是一个文件。本文 建立了Library数据库,存储系统内的管理员、图书、读者、借阅相关信息。         传统人工方式管理文件档案存在着许多缺点,如:效率低、保

    2024年02月04日
    浏览(56)
  • 基于PyQt5的UI界面开发——信号与槽

    PyQt5采用了一种被称为“信号与槽”机制的编程模式,用于处理对象间的通信和事件处理。在PyQt5中,信号(signal)是对象发出的特定事件,例如按钮被点击、文本被修改等。而槽(slot)是与信号相关联的特定动作或函数。当信号被触发时,与之相关联的槽会被自动调用。 槽

    2024年02月16日
    浏览(47)
  • 基于PyQt5的UI界面开发——对基本控件的介绍

    在PyQt中,控件是用户界面上的可见元素。控件可以包括按钮、标签、文本框、进度条等。每个控件都有自己的属性和方法,可以通过编程方式进行调整和操作。 以下是一些常用的PyQt控件: QLabel(标签):用于显示文本或图片的静态控件。 QPushButton(按钮):用于触发特定动

    2024年02月16日
    浏览(37)
  • 基于Java的图书借阅网站, java+springboot+vue开发的图书借阅管理系统 - 毕业设计 - 课程设计

    本程序实现图书的智能化、信息化和简单化;实现图书信息的增加、删除、修改、查找、借阅、还书、收藏的显示操作及实时数据库的提交和更改和对普通用户的增、删、改、查;提高图书管理员工作信息报送及反馈的工作效率,减轻管理员的劳动负担;提高信息的及时性和

    2024年04月28日
    浏览(74)
  • 图书管理系统|基于Springboot的图书管理系统设计与实现(源码+数据库+文档)

    图书管理系统目录 目录 基于Springboot的图书管理系统设计与实现 一、前言 二、系统功能设计 三、系统实现 1、个人中心 2、管理员管理 3、用户管理 4、图书出版社管理 四、数据库设计 1、实体ER图 五、核心代码  六、论文参考 七、最新计算机毕设选题推荐 八、源码获取:

    2024年03月26日
    浏览(90)
  • 一个简单的vue项目之图书管理系统,自用,无ui,持续更新...

    由于自己上一把忘记写log导致不小心把我的前端项目删了 重新随便写点log记录一下 由于各种版本不适配问题,请大家谨慎 看攻略 参考。 另外,由于博主主要还是写后端,所以对ui并没有加以处理,进阶就不需要参考了!但是博主还是很乐于学习的,如果有什么好的意见和建

    2024年02月06日
    浏览(53)
  • 学校图书管理系统的开发

    摘要 1 Abstract. 1 1 引言 2 1.1 图书管理的现状 2 1.2 现有图书管理系统的概述 3 1.3 选题的目的、意义 3 1.4 图书管理系统的可行性分析 4 1.5 系统开发运行环境 4 2 图书管理系统开发相关技术的介绍 5 2.1 Asp.net的介绍 5 2.1.1 Asp.net的优势介绍 5 2.1.2 Asp.net的特点 5 2.2 SQL Server 2005 概述

    2024年02月04日
    浏览(43)
  • 【vue后台管理系统】基于Vue+Element-UI+ECharts开发通用管理后台(中)

    点击菜单图标之前: 点击菜单图标之后: 首先我们要知道菜单栏的收缩,由el-menu的collapse属性控制: 我们通过分析可以知道: 菜单按钮的点击是在CommonHeader.vue组件中,而我们修改的collapse属性却在CommonAside.vue中,这是两个不同的组件。很明显这涉及到了组件间的通信问题,

    2024年02月03日
    浏览(50)
  • 基于javaweb的图书管理系统

    本项目采用eclipse工具开发,jsp+servlet技术编写,样式采用了layui前端框架,数据库采用的是mysql,navicat开发工具。 系统一共分为2个角色分别是: 管理员,学生 1、登录 2、修改个人信息 3、图书类型管理 4、图书管理 5、图书借阅管理 6、借阅审批管理 7、图书借阅统计 8、学生

    2024年02月04日
    浏览(44)
  • 基于JAVA的图书管理系统

                                                                    摘要         网络技术给生活带来了十分的便利。所以把图书管理与现在网络相结合。在图书馆发展的整个过程中,图书担负着最重要的角色。为满足如今日益复杂的管理需求,各类管理系统程序也

    2024年02月12日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包