Kaynağa Gözat

上传文件至 'Day5/PyQt登录/PyQTdeng'lu/digitapp'

wang 1 yıl önce
ebeveyn
işleme
7a8036bdcf

BIN
Day5/PyQt登录/PyQTdeng'lu/digitapp/.DS_Store


+ 16 - 0
Day5/PyQt登录/PyQTdeng'lu/digitapp/DigitApp.py

@@ -0,0 +1,16 @@
+"""
+"""
+from PyQt5.QtWidgets import QApplication
+from .DigitForm import DigitForm
+import sys
+
+class DigitApp(QApplication):
+    """
+    """
+    def __init__(self):
+        """
+        """
+        super(DigitApp, self).__init__(sys.argv)
+        # 创建应用主窗体
+        self.dlg = DigitForm()
+        self.dlg.show()

+ 34 - 0
Day5/PyQt登录/PyQTdeng'lu/digitapp/DigitForm.py

@@ -0,0 +1,34 @@
+from PyQt5.QtWidgets import QDialog
+from PyQt5.QtGui import QImage, QPixmap
+import sys
+from .DigitUI1 import Ui_Digit
+
+import numpy as np
+
+class DigitForm(QDialog):
+    def __init__(self):
+        super(DigitForm, self).__init__()
+        # 加载UI(先设计好)
+        # 创建对象
+        self.ui = Ui_Digit()
+        # 使用setupUi绑定对话框(父窗体)
+        self.ui.setupUi(self)
+
+
+
+
+
+    def capture_image(self):
+        if (self.ui.lbl_user.toPlainText() == 'yh') & (self.ui.lbl_pwd.toPlainText() == '123') :
+            self.ui.lbl_result.setText('欢迎:' + self.ui.lbl_user.toPlainText())
+        else:
+            self.ui.lbl_result.setText('用户名或者密码错误')
+
+
+
+
+
+
+
+
+

+ 68 - 0
Day5/PyQt登录/PyQTdeng'lu/digitapp/DigitUI1.py

@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'DigitUI1.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.9
+#
+# 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_Digit(object):
+    def setupUi(self, Digit):
+        Digit.setObjectName("Digit")
+        Digit.resize(653, 166)
+        Digit.setStyleSheet("QPushButton{\n"
+"    border-style:solid;\n"
+"    border-width:1px;\n"
+"    border-radius:8px;\n"
+"    border-top-color:#FFFFFF;\n"
+"    border-bottom-color:#888888;\n"
+"    border-left-color:#FFFFFF;\n"
+"    border-right-color:#888888;\n"
+"}\n"
+"QLabel#lbl_top1,#lbl_top2{\n"
+"    color:red;\n"
+"    font-size:24px;\n"
+"}\n"
+"QLabel#lbl_prob1,#lbl_prob2{\n"
+"    color:blue;\n"
+"}")
+        self.btn_recognize = QtWidgets.QPushButton(Digit)
+        self.btn_recognize.setGeometry(QtCore.QRect(300, 200, 92, 28))
+        self.btn_recognize.setObjectName("btn_recognize")
+        self.label = QtWidgets.QLabel(Digit)
+        self.label.setGeometry(QtCore.QRect(220, 10, 81, 41))
+        self.label.setObjectName("label")
+        self.lbl_user = QtWidgets.QTextEdit(Digit)
+        self.lbl_user.setGeometry(QtCore.QRect(300, 20, 111, 31))
+        self.lbl_user.setObjectName("lbl_user")
+        self.label_2 = QtWidgets.QLabel(Digit)
+        self.label_2.setGeometry(QtCore.QRect(230, 70, 60, 16))
+        self.label_2.setObjectName("label_2")
+        self.lbl_pwd = QtWidgets.QTextEdit(Digit)
+        self.lbl_pwd.setGeometry(QtCore.QRect(300, 60, 111, 31))
+        self.lbl_pwd.setObjectName("lbl_pwd")
+        self.btn_login = QtWidgets.QPushButton(Digit)
+        self.btn_login.setGeometry(QtCore.QRect(270, 110, 113, 32))
+        self.btn_login.setObjectName("btn_login")
+        self.lbl_result = QtWidgets.QLabel(Digit)
+        self.lbl_result.setGeometry(QtCore.QRect(500, 50, 111, 41))
+        self.lbl_result.setText("")
+        self.lbl_result.setObjectName("lbl_result")
+        # self.lbl_result.
+
+        self.retranslateUi(Digit)
+        self.btn_login.clicked.connect(Digit.capture_image) # type: ignore
+        QtCore.QMetaObject.connectSlotsByName(Digit)
+
+    def retranslateUi(self, Digit):
+        _translate = QtCore.QCoreApplication.translate
+        Digit.setWindowTitle(_translate("Digit", "手写数字识别程序"))
+        self.btn_recognize.setText(_translate("Digit", "数组识别"))
+        self.label.setText(_translate("Digit", "用户名:"))
+        self.label_2.setText(_translate("Digit", "密  码:"))
+        self.btn_login.setText(_translate("Digit", "登录"))

BIN
Day5/PyQt登录/PyQTdeng'lu/digitapp/__init__.py