.exe file created with pyinstaller shuts down immediately when i run it - python

I want to create a simple app using qt5(qt designer) and pyintsaller for exe file. I successfully created a exe file but when i execute it, command line windows pop ups for a second and closes immediately. When I run the code in IDE or text editor it works fine. Do you have any idea what I am missing here. My code looks like this.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(462, 443)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(160, 70, 161, 91))
font = QtGui.QFont()
font.setPointSize(27)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(170, 170, 151, 71))
font = QtGui.QFont()
font.setPointSize(24)
self.pushButton.setFont(font)
self.pushButton.setObjectName("pushButton")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 462, 18))
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.label.setText(_translate("MainWindow", "HELLO"))
self.pushButton.setText(_translate("MainWindow", "OK"))
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_())

tested with pyinstaller 3.5 . working

Related

how to create a new label when a button is pressed in pyqt5

i have this code:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'scroll_test.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1034, 669)
self.current_y = 200
self.current_x = 390
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setStyleSheet("background-color: rgb(21, 131, 43);")
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 997, 1218))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.frame = QtWidgets.QFrame(self.scrollAreaWidgetContents)
self.frame.setMinimumSize(QtCore.QSize(0, 1200))
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.pushButton = QtWidgets.QPushButton(self.frame)
self.pushButton.setGeometry(QtCore.QRect(390, 150, 191, 141))
self.pushButton.setStyleSheet("background-color: rgb(33, 37, 255);")
self.pushButton.setObjectName("pushButton")
self.label = QtWidgets.QLabel(self.frame)
self.label.setGeometry(QtCore.QRect(320, -50, 351, 201))
font = QtGui.QFont()
font.setFamily("Yu Gothic")
font.setPointSize(50)
self.label.setFont(font)
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.frame)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout.addWidget(self.scrollArea)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1034, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.pushButton.clicked.connect(self.add_label)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "PushButton"))
self.label.setText(_translate("MainWindow", "Mega Chat"))
def add_label(self):
self.new_label = QtWidgets.QLabel(self.frame)
self.new_label.setGeometry(self.current_x, self.current_y, 50, 50)
self.new_label.setText("Mega Chat")
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_())
im trying to create a new label and display it on the screen when the button is pressed but nothing happens when i press it. i can modify values of existing labels but i cant figure out how to make new ones while the program is running i have a starting x, y values and im trying to make a new object inside the function then set the geometry and text of the label the problem is just displaying the label on the screen and i cant figure out what im doing wrong.
the issue here is that you're not showing the label after adding it, you can fix that by adding
self.new_label.show()
at the end of your add_label function.

argument 1 has unexpected type 'EnumMeta'

I am trying to display a simple GUI
# Form implementation generated from reading ui file 'UI/form.ui'
# Created by: PyQt6 UI code generator 6.1.0
# WARNING: Any manual changes made to this file will be lost when pyuic6
# is run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(886, 487)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.Enter = QtWidgets.QPushButton(self.centralwidget)
self.Enter.setObjectName("Enter")
self.gridLayout.addWidget(self.Enter, 2, 0, 1, 1)
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft)
self.label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.centralwidget)
self.plainTextEdit.setObjectName("plainTextEdit")
self.gridLayout.addWidget(self.plainTextEdit, 1, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 886, 20))
self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actionUpload = QtGui.QAction(MainWindow)
self.actionUpload.setShortcutContext(QtCore.Qt.WindowShortcut)
self.actionUpload.setMenuRole(QtGui.QAction.AboutQtRole)
self.actionUpload.setObjectName("actionUpload")
self.menuFile.addAction(self.actionUpload)
self.menubar.addAction(self.menuFile.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.Enter.setText(_translate("MainWindow", "Enter"))
self.label.setText(_translate("MainWindow", "Enter Text Below Or Upload File"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.actionUpload.setText(_translate("MainWindow", "Upload"))
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())
but I get
Exception has occurred: TypeError
I have tried using pyuic6 again and to no avail
I am using PyQt6 and am running a Debian Linux based OS
If this code is generated by pyuic then it is a PyQt bug. In PyQt6 the flags and enumerations are stricter so you must change
self.actionUpload.setShortcutContext(QtCore.Qt.WindowShortcut)
self.actionUpload.setMenuRole(QtGui.QAction.AboutQtRole)
to:
self.actionUpload.setShortcutContext(QtCore.Qt.ShortcutContext.WindowShortcut)
self.actionUpload.setMenuRole(QtGui.QAction.MenuRole.AboutQtRole)

How do I show a subwindow in a MDI area?

So am testing a bit with MDI area, the problem is that when I try to Open a Subwindow inside the MDI this happens.
Any way to make the Little Subwindow bigger enough to be readble?
Am doing Everything inside an only test file.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(488, 392)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_3.setGeometry(QtCore.QRect(280, 290, 91, 51))
self.pushButton_3.setObjectName("pushButton_3")
self.pushButton_3.clicked.connect(self.Open)
self.mdiArea = QtWidgets.QMdiArea(self.centralwidget)
self.mdiArea.setGeometry(QtCore.QRect(60, 20, 261, 211))
self.mdiArea.setObjectName("mdiArea")
self.subwindow = QtWidgets.QWidget()
self.subwindow.setObjectName("subwindow")
self.pushButton = QtWidgets.QPushButton(self.subwindow)
self.pushButton.setGeometry(QtCore.QRect(100, 80, 56, 17))
self.pushButton.setObjectName("pushButton")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 488, 18))
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 Open(self):
self.mdiArea.addSubWindow(self.subwindow)
self.subwindow.show()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton_3.setText(_translate("MainWindow", "Open"))
self.subwindow.setWindowTitle(_translate("MainWindow", "Subwindow"))
self.pushButton.setText(_translate("MainWindow", "YAY!"))
class mywindow(QtWidgets.QMainWindow):
def __init__(self):
super(mywindow, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
app = QtWidgets.QApplication([])
application = mywindow()
application.show()
app.exec()
You have to resize the QMdiSubWindow:
def Open(self):
sw = self.mdiArea.addSubWindow(self.subwindow)
self.subwindow.show()
sw.resize(640, 480)

How to connect 3 different programs in one main file using pyqt5?

I have 3 programs here, and I have a problem in running those 3 programs because I want it to be all imported to the main file and connected to each other after clicking the buttons on each window. My problem here is that after I have reached the 2nd window, when I click the button there then it doesn't proceed to the last window but instead the window crashes. What would I change in my program so that it will not crash?
s1.py (main program)
from PyQt5 import QtCore, QtGui, QtWidgets
from s4 import *
from s3 import *
class Ui_MainWindow(object):
def ok (self):
self.window=QtWidgets.QMainWindow()
self.ui=Ui_MainWindow2()
self.ui.setup(self.window)
self.window.show()
MainWindow.hide()
def proceed (self):
self.window1=QtWidgets.QMainWindow()
self.ui1=Ui_MainWindow3()
self.ui1.setup1(self.window1)
self.window1.show()
MainWindow2.hide()
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(330, 220, 93, 28))
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.ok)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
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.pushButton.setText(_translate("MainWindow", "ok"))
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_())
s4.py (2nd program)
from PyQt5 import QtCore, QtGui, QtWidgets
from s3 import *
class Ui_MainWindow2(object):
def proceed (self):
self.window1=QtWidgets.QMainWindow()
self.ui1=Ui_MainWindow3()
self.ui1.setup1(self.window1)
self.window1.show()
MainWindow2.hide()
def setup(self, MainWindow2):
MainWindow2.setObjectName("MainWindow2")
MainWindow2.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow2)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(320, 270, 93, 28))
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.proceed)
MainWindow2.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow2)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
self.menubar.setObjectName("menubar")
MainWindow2.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow2)
self.statusbar.setObjectName("statusbar")
MainWindow2.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow2)
QtCore.QMetaObject.connectSlotsByName(MainWindow2)
def retranslateUi(self, MainWindow2):
_translate = QtCore.QCoreApplication.translate
MainWindow2.setWindowTitle(_translate("MainWindow2", "MainWindow"))
self.pushButton.setText(_translate("MainWindow2", "PROCEED"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow2 = QtWidgets.QMainWindow()
ui = Ui_MainWindow2()
ui.setup(MainWindow2)
MainWindow2.show()
sys.exit(app.exec_())
s3.py(3rd program)
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow3(object):
def setup1(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(260, 190, 451, 181))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.label.setFont(font)
self.label.setObjectName("label")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
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.label.setText(_translate("MainWindow", "THIS IS MY LAST WINDOW"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow3()
ui.setup1(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
from PyQt5 import QtCore, QtGui, QtWidgets
from s4 import Ui_MainWindow2
class Ui_MainWindow(object):
def ok (self):
self.window=QtWidgets.QMainWindow()
self.ui=Ui_MainWindow2()
self.ui.setup(self.window)
self.window.show()
MainWindow.hide()
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(330, 220, 93, 28))
self.pushButton.setObjectName("pushButton")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
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)
self.pushButton.clicked.connect(self.ok)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "ok"))
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_())
and import Ui_MainWindow3 from s3.py into s4 file and call proceed function as well as:
from s3 import Ui_MainWindow3

PyQt - Open the same page several times [duplicate]

This question already has an answer here:
PyQT: how to open new window
(1 answer)
Closed 3 years ago.
I want, from my Index.py page, to open several times the page Form.py.
For the moment when i try to open Form a second time the first Form page closes.
There is my Index.py code :
from PyQt5 import QtCore, QtGui, QtWidgets
from Form import Ui_FormWindow
class Ui_MainWindow(object):
#The function to open the Form.py
def open(self):
self.window = QtWidgets.QMainWindow()
self.ui = Ui_FormWindow()
self.ui.setupUi(self.window)
self.window.show()
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(230, 180, 93, 28))
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.open)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
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.pushButton.setText(_translate("MainWindow", "PushButton"))
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_())
And here is the page i want to open several times, Form.py :
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FormWindow(object):
def setupUi(self, FormWindow):
FormWindow.setObjectName("FormWindow")
FormWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(FormWindow)
self.centralwidget.setObjectName("centralwidget")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(250, 190, 113, 22))
self.lineEdit.setObjectName("lineEdit")
FormWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(FormWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
self.menubar.setObjectName("menubar")
FormWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(FormWindow)
self.statusbar.setObjectName("statusbar")
FormWindow.setStatusBar(self.statusbar)
self.retranslateUi(FormWindow)
QtCore.QMetaObject.connectSlotsByName(FormWindow)
def retranslateUi(self, FormWindow):
_translate = QtCore.QCoreApplication.translate
FormWindow.setWindowTitle(_translate("FormWindow", "FormWindow"))
self.lineEdit.setText(_translate("FormWindow", "Page to open"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
FormWindow = QtWidgets.QMainWindow()
ui = Ui_FormWindow()
ui.setupUi(FormWindow)
FormWindow.show()
sys.exit(app.exec_())
I checked this answer but i don't understand how to make it work in my code.
I also edited my question in order to be a minimal reproducible example but my english is not perfect and i fear to not understand perfectly what i read on the mre tutotial so sorry
I haven't done QT stuff in a while but could it be the fact that you're instancing QtWidgets.QMainWindow again? That'd be my first guess.

Categories

Resources