SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PyQt5 import QtWidgets, QtGui
  2. from PyQt5.QtCore import Qt
  3. from auth import Ui_MainWindow  # импорт нашего сгенерированного файла
  4. from PyQt5.QtWidgets import QLineEdit, QMessageBox
  5. from reg import Ui_Registr
  6. import sys
  7.  
  8.  
  9. class Mywindow(QtWidgets.QMainWindow):
  10.     def __init__(self):
  11.         self.Type = True
  12.         super(Mywindow, self).__init__()
  13.         self.ui = Ui_MainWindow()
  14.         self.ui.setupUi(self)
  15.         self.setFixedSize(242, 440)
  16.         self.setWindowTitle('Авторизация')
  17.         font = QtGui.QFont("Times", 12, QtGui.QFont.Bold)
  18.         fonts = QtGui.QFont("Times", 12, QtGui.QFont.Bold)
  19.         self.ui.lineEdit.setFont(font)
  20.         self.ui.lineEdit_2.setFont(fonts)
  21.         self.ui.lineEdit_2.setEchoMode(QLineEdit.Password)
  22.         self.ui_label()
  23.  
  24.     def ui_label(self):
  25.         self.ui.label_2.setText('PASSWORD')
  26.         self.ui.label_2.setAlignment(Qt.AlignCenter)
  27.         self.ui.label_2.setFont(QtGui.QFont("Times", 20, QtGui.QFont.Cursive))
  28.         self.ui.label.setAlignment(Qt.AlignCenter)
  29.         self.ui.label.setFont(QtGui.QFont("Times", 20))
  30.         self.ui.label.setText('LOGIN')
  31.         self.click()
  32.  
  33.     def click(self):
  34.         self.ui.pushButton.clicked.connect(self.click_auth)
  35.  
  36.     def click_auth(self):
  37.         login = self.ui.lineEdit.text()
  38.         password = self.ui.lineEdit_2.text()
  39.         print(login, '', password)
  40.         if login == 'hello' and password == 'hello':
  41.             self.w2 = Program()
  42.             self.w2.show()
  43.             application.hide()
  44.         else:
  45.             QMessageBox.warning(self, 'Ошибка', "Неверный логин или пароль")
  46.  
  47.  
  48. class Program(QtWidgets.QMainWindow):
  49.     def __init__(self):
  50.         super(Program, self).__init__()
  51.         self.ui = Ui_Registr()
  52.         self.ui.setupUi(self)
  53.         self.setWindowTitle('Программа')
  54.         self.ui.pushButton.clicked.connect(self.btn)
  55.  
  56.     def btn(self):
  57.         self.w1 = Mywindow()
  58.         self.w1.hide()
  59.         application.show()
  60.  
  61.  
  62. app = QtWidgets.QApplication([])
  63. application = Mywindow()
  64. application.show()
  65.  
  66. sys.exit(app.exec())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top