Im using Pyside6 with pyqt6 on Qt designer. I just tried to make a basic pushbutton (which does nothing) inside a grid layout inside the main window on the Qt designer. I saved that file in ui format and converted into python file using the uic.exe present in the pyside6 library. So the problem is that this pyside6 uic.exe converter gives the python file with only classes and objects and by following some threads on stack overflow, I used the window.show() method and it says AttributeError: 'Ui_MainWindow' object has no attribute 'show'. I dont know how to get the output and I dont know what function I need to call to get the output.
Here is the code generated by uic.exe in pyside6
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'testing1.ui'
##
## Created by: Qt User Interface Compiler version 6.4.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QGridLayout, QMainWindow, QMenuBar,
QPushButton, QSizePolicy, QStatusBar, QWidget)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(842, 643)
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.gridLayoutWidget = QWidget(self.centralwidget)
self.gridLayoutWidget.setObjectName(u"gridLayoutWidget")
self.gridLayoutWidget.setGeometry(QRect(10, 20, 801, 561))
self.gridLayout = QGridLayout(self.gridLayoutWidget)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.pushButton = QPushButton(self.gridLayoutWidget)
self.pushButton.setObjectName(u"pushButton")
self.gridLayout.addWidget(self.pushButton, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 842, 22))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QStatusBar(MainWindow)
self.statusbar.setObjectName(u"statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QMetaObject.connectSlotsByName(MainWindow)
# setupUi
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
self.pushButton.setText(QCoreApplication.translate("MainWindow", u"PushButton", None))
# retranslateUi
#the below code is written by me seeing the other stackoverflow question related to this issue
app = QApplication([])
window = Ui_MainWindow()
window.show()
app.exec()
[This shows the Qt designer ](https://i.stack.imgur.com/UZ2pc.png)
The thing is that I want this python program to show some output like the window shown in the Qt designer. Any help would be awesome. As im a beginner in both pyqt6 and Qt designer kindly elobrate the answer please.