基本信息
源码名称:pyqt5登录界面
源码大小:2.65KB
文件格式:.rar
开发语言:Python
更新时间:2021-10-13
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
利用qt5设计登录界面

# -*- coding: utf-8 -*-   from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtCore import Qt, pyqtSignal, QTimer import first1 import jinggao class Ui_Dialog_log(object):
    usr_id = "138"  pwd = "138"  def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(400, 300)
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(12) Dialog.setFont(font) self.lineEdit = QtWidgets.QLineEdit(Dialog) self.lineEdit.setGeometry(QtCore.QRect(120, 50, 161, 31)) self.lineEdit.setObjectName("lineEdit") self.lineEdit_2 = QtWidgets.QLineEdit(Dialog) self.lineEdit_2.setGeometry(QtCore.QRect(120, 110, 161, 31)) self.lineEdit_2.setObjectName("lineEdit_2") self.label = QtWidgets.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(60, 50, 51, 31)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(Dialog) self.label_2.setGeometry(QtCore.QRect(60, 110, 61, 31))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(12) self.label_2.setFont(font) self.label_2.setObjectName("label_2") self.pushButton = QtWidgets.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(120, 230, 75, 23)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtWidgets.QPushButton(Dialog) self.pushButton_2.setGeometry(QtCore.QRect(240, 230, 75, 23)) self.pushButton_2.setObjectName("pushButton_2") self.retranslateUi(Dialog) def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "账号登录")) self.label.setText(_translate("Dialog", "账号")) self.label_2.setText(_translate("Dialog", "密码")) self.pushButton.setText(_translate("Dialog", "登录")) self.pushButton_2.setText(_translate("Dialog", "取消")) import sys if __name__ == "__main__": # -*- coding: utf-8 -*-  usr_id = "138"  pwd = "138"  #,encoding="utf-8"    def log_in():
        str1 = ui1.lineEdit.text()
        str2 = ui1.lineEdit_2.text() if (str1 == usr_id) & (str2 == pwd): print("账号密码正确")
            Widget1.close()
            Wid_first.show() else:
            Widget2.show()
    app = QtWidgets.QApplication(sys.argv) ##/*****  Widget2 = QtWidgets.QWidget()
    ui2 = jinggao.Ui_Dialog()
    ui2.setupUi(Widget2) # Widget1ui联系起来  ui2.retranslateUi(Widget2) ##警告模块 ##*****/  ##/*****  Wid_first = QtWidgets.QMainWindow()
    main_first = first1.Ui_MainWindow()
    main_first.setupUi(Wid_first) ##主模块 ##*****/   ##/*****  #登录模块  Widget1 = QtWidgets.QWidget()
    ui1 =  Ui_Dialog_log()
    ui1.setupUi(Widget1)
    ui1.retranslateUi(Widget1)
    Widget1.show() ##*****/  ui1.pushButton.clicked.connect(log_in) # 登录键相应工作Widget1.show  ui1.pushButton_2.clicked.connect(Widget1.close) # 取消键关闭登录页面  ui2.pushButton.clicked.connect(Widget2.close) # 警告页面按下后退出警告页面  main_first.pushButton_5.clicked.connect(Wid_first.close)
    sys.exit(app.exec_())