0
I can’t seem to make the other window in my file appear.
Code:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'testando.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(950, 600)
MainWindow.setMaximumSize(QtCore.QSize(950, 600))
MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.txtBemVindo = QtWidgets.QLabel(self.centralwidget)
self.txtBemVindo.setGeometry(QtCore.QRect(270, 60, 431, 171))
font = QtGui.QFont()
font.setFamily("Narkisim")
font.setPointSize(48)
font.setUnderline(True)
self.txtBemVindo.setFont(font)
self.txtBemVindo.setObjectName("txtBemVindo")
self.btInciar = QtWidgets.QPushButton(self.centralwidget)
self.btInciar.setGeometry(QtCore.QRect(370, 300, 191, 81))
self.btInciar.setObjectName("btInciar")
self.btInciar.clicked.connect(self.evtIniciar)
self.btSair = QtWidgets.QPushButton(self.centralwidget)
self.btSair.setGeometry(QtCore.QRect(840, 500, 112, 34))
self.btSair.setObjectName("btSair")
self.btSair.clicked.connect(self.evtSair)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 950, 31))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.txtBemVindo.setText(_translate("MainWindow", "Bem Vindo"))
self.btInciar.setText(_translate("MainWindow", "Clique Aqui Para Iniciar"))
self.btSair.setText(_translate("MainWindow", "Sair"))
def evtSair(self):
exit(0)
def evtIniciar(self):
Tela1.show()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
class Ui_Tela1(object):
def setupUi(self, Tela1):
Tela1.setObjectName("Tela1")
Tela1.resize(600, 300)
self.label = QtWidgets.QLabel(Tela1)
self.label.setGeometry(QtCore.QRect(30, 50, 451, 161))
font = QtGui.QFont()
font.setPointSize(36)
self.label.setFont(font)
self.label.setObjectName("label")
self.retranslateUi(Tela1)
QtCore.QMetaObject.connectSlotsByName(Tela1)
def retranslateUi(self, Tela1):
_translate = QtCore.QCoreApplication.translate
Tela1.setWindowTitle(_translate("Tela1", "Dialog"))
self.label.setText(_translate("Tela1", "Bem Vindo"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Tela1 = QtWidgets.QDialog()
ui = Ui_Tela1()
ui.setupUi(Tela1)
Tela1.show()
sys.exit(app.exec_())
Welcome to Stack Overflow. It would be good to build your question better by providing more details and explaining what is happening. Two-line "clarification" questions are difficult to understand and tend to get no answer.
– Chun