How to open a second window in PyQt5?

I have two window design

start
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '1-int.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Start(object):
 def setupUi(self, Start):
Start.setObjectName("Ui_Start")
 Start.resize(443, 293)
 Start.setStyleSheet("QPushButton:hover {backgroun-color: red} \n"
"QPushButton:pressed {backgroun-color: yellow\n"
"}\n"
"QPushButton{\n"
"font: 45pt \"Molot\";\n"
"backgroun-color: white;\n"
"width: 75px ;\n"
"height: 50px;\n"
"font-size: 45px;\n"
"font-weight: bold;\n"
"bolder: none;\n"
"text-align: center\n"
"}\n"
"\n"
"")
 self.lineEdit = QtWidgets.QLineEdit(Start)
 self.lineEdit.setGeometry(QtCore.QRect(50, 80, 321, 51))
self.lineEdit.setStyleSheet("")
self.lineEdit.setText("")
self.lineEdit.setObjectName("lineEdit")
 self.textEdit = QtWidgets.QTextEdit(Start)
 self.textEdit.setGeometry(QtCore.QRect(10, 30, 421, 41))
self.textEdit.setObjectName("textEdit")
 self.pushButton_2 = QtWidgets.QPushButton(Start)
 self.pushButton_2.setGeometry(QtCore.QRect(150, 210, 141, 58))
 self.pushButton_2.setStyleSheet("font: 16pt \"Molot\";")
self.pushButton_2.setObjectName("pushButton_2")
 self.pushButton = QtWidgets.QPushButton(Start)
 self.pushButton.setGeometry(QtCore.QRect(50, 140, 321, 58))
self.pushButton.setObjectName("pushButton")

self.retranslateUi(Start)
QtCore.QMetaObject.connectSlotsByName(Start)

 def retranslateUi(self, v):
 _translate = QtCore.QCoreApplication.translate
 Start.setWindowTitle(_translate("Start", "Start"))
 self.textEdit.setHtml(_translate("Start", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25 pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:16pt;\">enter a number and a letter grade of class :</span></p></body></html>"))
 self.pushButton_2.setText(_translate("Start", "manual"))
 self.pushButton.setText(_translate("Start", "1"))


if __name__ == "__main__":
 import sys
 app = QtWidgets.QApplication(sys.argv)
 Start = QtWidgets.QWidget()
 ui = Ui_Start()
ui.setupUi(Start)
Start.show()
 sys.exit(app.exec_())


inst:
from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Inst(object):
 def setupUi(self, Inst):
Inst.setObjectName("Ui_Inst")
 Inst.resize(1111, 883)
 self.textEdit = QtWidgets.QTextEdit(v)
 self.textEdit.setGeometry(QtCore.QRect(0, 10, 1111, 41))
self.textEdit.setObjectName("textEdit")
 self.text_inctru = QtWidgets.QTextEdit(Inst)
 self.text_inctru.setGeometry(QtCore.QRect(20, 60, 1071, 811))
self.text_inctru.setObjectName("text_inctru")

self.retranslateUi(Inst)
QtCore.QMetaObject.connectSlotsByName(v)

 def retranslateUi(self, Inst):
 _translate = QtCore.QCoreApplication.translate
 Inst.setWindowTitle(_translate("Inst", "Inst"))
 self.textEdit.setHtml(_translate("Inst", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25 pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:22pt;\">manual</span></p></body></html>"))


How to open second window by pressing the button.
April 3rd 20 at 17:31
0 answer

Find more questions by tags PythonPyQt