Answer the question
In order to leave comments, you need to log in
Hiding a window and opening another in PyQt, how to do?
There is a problem:
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
uic.loadUi("Ui/Main.ui")
class Authorize(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
uic.loadUi('Ui/Authorize.ui', self)
self.regButton.clicked.connect(self.closeWindows)
self.dialog = MainWindow()
def closeWindows(self):
self.hide()
self.dialog.setWindowTitle("Спрятали предыдущее")
self.dialog.resize(300, 70)
self.dialog.show()
def main():
app = QtWidgets.QApplication(sys.argv) # Новый экземпляр QApplication
mainWindow = MainWindow() # Создаём объект класса MainWindow
mainWindow.show() # Показываем окно
app.exec_() # и запускаем приложение
if __name__ == '__main__': # Если мы запускаем файл напрямую, а не импортируем
main() # то запускаем функцию main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question