Как сделать так, что бы при клике на определенною кнопку ( к примеру, пусть это у меня будет registation_button ) открывалось новое окно?
Определил два класса ( один для нового окна, второй для главного), но никак не могу разобраться в своем вопросе.
Код прилагаю.
from PyQt5 import QtCore, QtGui, QtWidgets class Inform(object): def __init__(self, Information): Information.setObjectName("Information") Information.resize(367, 157) self.result = QtWidgets.QLabel(Information) self.result.setGeometry(QtCore.QRect(20, 10, 331, 101)) font = QtGui.QFont() font.setPointSize(14) self.result.setFont(font) self.result.setAlignment(QtCore.Qt.AlignCenter) self.result.setObjectName("result") self.pushButton = QtWidgets.QPushButton(Information) self.pushButton.setGeometry(QtCore.QRect(140, 120, 75, 23)) self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(lambda: app.quit()) self.retranslateUi(Information) QtCore.QMetaObject.connectSlotsByName(Information) def retranslateUi(self, Information): _translate = QtCore.QCoreApplication.translate Information.setWindowTitle(_translate("Information", "Information")) self.result.setText(_translate("Information", "Here will be result of something")) self.pushButton.setText(_translate("Information", "OK")) class Authorization_view(object): def __init__ (self, authorization): self.authorization = authorization self.authorization.setObjectName("Authorization") self.authorization.resize(461, 326) self.verseparator = QtWidgets.QFrame(authorization) self.verseparator.setGeometry(QtCore.QRect(220, 0, 20, 341)) self.verseparator.setFrameShape(QtWidgets.QFrame.VLine) self.verseparator.setFrameShadow(QtWidgets.QFrame.Sunken) self.verseparator.setObjectName("verseparator") self.registration_label = QtWidgets.QLabel(authorization) self.registration_label.setGeometry(QtCore.QRect(20, 30, 141, 31)) font = QtGui.QFont() font.setPointSize(14) self.registration_label.setFont(font) self.registration_label.setObjectName("registration_label") self.authorization_label = QtWidgets.QLabel(authorization) self.authorization_label.setGeometry(QtCore.QRect(250, 40, 121, 16)) font = QtGui.QFont() font.setPointSize(14) self.authorization_label.setFont(font) self.authorization_label.setObjectName("authorization_label") self.login_label = QtWidgets.QLabel(authorization) self.login_label.setGeometry(QtCore.QRect(240, 80, 61, 31)) font = QtGui.QFont() font.setPointSize(10) self.login_label.setFont(font) self.login_label.setObjectName("login_label") self.password_label = QtWidgets.QLabel(authorization) self.password_label.setGeometry(QtCore.QRect(240, 130, 91, 16)) font = QtGui.QFont() font.setPointSize(10) self.password_label.setFont(font) self.password_label.setObjectName("password_label") self.status_label = QtWidgets.QLabel(authorization) self.status_label.setGeometry(QtCore.QRect(230, 210, 171, 51)) font = QtGui.QFont() font.setPointSize(12) self.status_label.setFont(font) self.status_label.setObjectName("status_label") self.authorization_button = QtWidgets.QPushButton(authorization) self.authorization_button.setGeometry(QtCore.QRect(300, 170, 75, 23)) font = QtGui.QFont() font.setPointSize(14) self.authorization_button.setFont(font) self.authorization_button.setObjectName("authorization_button") self.login_lineEdit = QtWidgets.QLineEdit(authorization) self.login_lineEdit.setGeometry(QtCore.QRect(280, 90, 113, 20)) font = QtGui.QFont() font.setPointSize(9) self.login_lineEdit.setFont(font) self.login_lineEdit.setText("") self.login_lineEdit.setObjectName("login_lineEdit") self.password_lineEdit = QtWidgets.QLineEdit(authorization) self.password_lineEdit.setGeometry(QtCore.QRect(304, 130, 111, 20)) self.password_lineEdit.setEchoMode(QtWidgets.QLineEdit.Password) font = QtGui.QFont() font.setPointSize(9) self.password_lineEdit.setFont(font) self.password_lineEdit.setObjectName("password_lineEdit") self.enter_login_label = QtWidgets.QLabel(authorization) self.enter_login_label.setGeometry(QtCore.QRect(10, 100, 111, 16)) font = QtGui.QFont() font.setPointSize(10) self.enter_login_label.setFont(font) self.enter_login_label.setObjectName("enter_login_label") self.enter_password_label = QtWidgets.QLabel(authorization) self.enter_password_label.setGeometry(QtCore.QRect(10, 130, 131, 16)) font = QtGui.QFont() font.setPointSize(10) self.enter_password_label.setFont(font) self.enter_password_label.setObjectName("enter_password_label") self.enter_loginlineEdit = QtWidgets.QLineEdit(authorization) self.enter_loginlineEdit.setGeometry(QtCore.QRect(115, 100, 105, 20)) font = QtGui.QFont() font.setPointSize(9) self.enter_loginlineEdit.setFont(font) self.enter_loginlineEdit.setText("") self.enter_loginlineEdit.setObjectName("enter_loginlineEdit") self.enter_password_lineEdit = QtWidgets.QLineEdit(authorization) self.enter_password_lineEdit.setGeometry(QtCore.QRect(140, 130, 81, 20)) self.enter_password_lineEdit.setEchoMode(QtWidgets.QLineEdit.Password) font = QtGui.QFont() font.setPointSize(9) self.enter_password_lineEdit.setFont(font) self.enter_password_lineEdit.setText("") self.enter_password_lineEdit.setObjectName("enter_password_lineEdit") self.enter_name_label = QtWidgets.QLabel(authorization) self.enter_name_label.setGeometry(QtCore.QRect(10, 170, 111, 16)) font = QtGui.QFont() font.setPointSize(10) self.enter_name_label.setFont(font) self.enter_name_label.setObjectName("enter_name_label") self.enter_surname_label = QtWidgets.QLabel(authorization) self.enter_surname_label.setGeometry(QtCore.QRect(10, 210, 121, 16)) font = QtGui.QFont() font.setPointSize(10) self.enter_surname_label.setFont(font) self.enter_surname_label.setObjectName("enter_surname_label") self.enter_surname_lineEdit_2 = QtWidgets.QLineEdit(authorization) self.enter_surname_lineEdit_2.setGeometry(QtCore.QRect(130, 210, 81, 20)) font = QtGui.QFont() font.setPointSize(9) self.retranslateUi(authorization) QtCore.QMetaObject.connectSlotsByName(authorization) def retranslateUi(self, authorization): _translate = QtCore.QCoreApplication.translate authorization.setWindowTitle(_translate("authorization", "Autorithation")) self.registration_label.setText(_translate("authorization", "Registration")) self.authorization_label.setText(_translate("authorization", "Authorization")) self.login_label.setText(_translate("authorization", "Login:")) self.password_label.setText(_translate("authorization", "Password:")) self.status_label.setText(_translate("authorization", " !")) self.authorization_button.setText(_translate("authorization", "OK")) self.enter_login_label.setText(_translate("authorization", "Login (> 6 symb):")) self.enter_password_label.setText(_translate("authorization", "Password (> 6 symb):")) self.enter_name_label.setText(_translate("authorization", "Enter your name:")) self.enter_surname_label.setText(_translate("authorization", "Enter your surname:")) self.enter_email_label_2.setText(_translate("authorization", "Enter your e-mail:")) self.registation_button.setText(_translate("authorization", "OK")) self.registr_status.setText(_translate("authorization", " !"))
P.S Код немного сократил.