锋哥原创的PyQt6图书管理系统视频教程:
PyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~_哔哩哔哩_bilibiliPyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~共计18条视频,包括:PyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~、第2讲 登录功能UI设计实现、第3讲 数据库操作工具包dbUtil.py封装等,UP主更多精彩视频,请关注UP账号。https://www.bilibili.com/video/BV18t4y1R7Qp/我们使用Qt Designer 设计登录页面
我们用PyUIC工具,把“登录.ui”转成Python代码:
# Form implementation generated from reading ui file '登录.ui'
#
# Created by: PyQt6 UI code generator 6.4.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.from PyQt6 import QtCore, QtGui, QtWidgetsclass Ui_Form(object):def setupUi(self, Form):Form.setObjectName("Form")Form.resize(517, 423)self.formLayoutWidget = QtWidgets.QWidget(parent=Form)self.formLayoutWidget.setGeometry(QtCore.QRect(100, 130, 311, 131))self.formLayoutWidget.setObjectName("formLayoutWidget")self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget)self.formLayout.setContentsMargins(30, 10, 10, 0)self.formLayout.setHorizontalSpacing(30)self.formLayout.setVerticalSpacing(50)self.formLayout.setObjectName("formLayout")self.label = QtWidgets.QLabel(parent=self.formLayoutWidget)font = QtGui.QFont()font.setPointSize(12)self.label.setFont(font)self.label.setObjectName("label")self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label)self.lineEdit = QtWidgets.QLineEdit(parent=self.formLayoutWidget)self.lineEdit.setObjectName("lineEdit")self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.lineEdit)self.label_2 = QtWidgets.QLabel(parent=self.formLayoutWidget)font = QtGui.QFont()font.setPointSize(12)self.label_2.setFont(font)self.label_2.setObjectName("label_2")self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2)self.lineEdit_2 = QtWidgets.QLineEdit(parent=self.formLayoutWidget)self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)self.lineEdit_2.setObjectName("lineEdit_2")self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.lineEdit_2)self.pushButton = QtWidgets.QPushButton(parent=Form)self.pushButton.setGeometry(QtCore.QRect(130, 280, 101, 31))icon = QtGui.QIcon()icon.addPixmap(QtGui.QPixmap("../images/login.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)self.pushButton.setIcon(icon)self.pushButton.setObjectName("pushButton")self.pushButton_2 = QtWidgets.QPushButton(parent=Form)self.pushButton_2.setGeometry(QtCore.QRect(300, 280, 91, 31))icon1 = QtGui.QIcon()icon1.addPixmap(QtGui.QPixmap("../images/reset.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)self.pushButton_2.setIcon(icon1)self.pushButton_2.setObjectName("pushButton_2")self.label_3 = QtWidgets.QLabel(parent=Form)self.label_3.setGeometry(QtCore.QRect(190, 60, 221, 51))font = QtGui.QFont()font.setPointSize(26)self.label_3.setFont(font)self.label_3.setObjectName("label_3")self.label_4 = QtWidgets.QLabel(parent=Form)self.label_4.setGeometry(QtCore.QRect(120, 50, 61, 61))self.label_4.setText("")self.label_4.setPixmap(QtGui.QPixmap("../images/logo.png"))self.label_4.setObjectName("label_4")self.retranslateUi(Form)QtCore.QMetaObject.connectSlotsByName(Form)def retranslateUi(self, Form):_translate = QtCore.QCoreApplication.translateForm.setWindowTitle(_translate("Form", "管理员登录"))self.label.setText(_translate("Form", "用户名:"))self.label_2.setText(_translate("Form", "密 码:"))self.pushButton.setText(_translate("Form", "登录"))self.pushButton_2.setText(_translate("Form", "重置"))self.label_3.setText(_translate("Form", "图书管理系统"))
我们后续再这个代码基础上,进行管理员登录业务逻辑的开发实现。