I am kind new on Pyqt5 and trying to make a Import / Export UI. Have couple errors and cant find what Im doing wrong.. I"ll be glad if I can get some Answers..
I guess I am doing some wrong things with init and super but cant figure out.
Here my Code and Error.
from PyQt5 import QtCore, QtGui, QtWidgets
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
MainWindow.setWindowTitle("Gen")
MainWindow.setFixedSize(1250,802)
#Box 1
self.groupBox = QtWidgets.QGroupBox(MainWindow)
self.groupBox.setGeometry(5,0, 350,400)
self.groupBox.setTitle("BOX 1")
#Box 2
self.groupBox_2 = QtWidgets.QGroupBox(MainWindow)
self.groupBox_2.setGeometry(5,400,350,400)
self.groupBox_2.setTitle("BOX 2")
#Import and Export Button at Box 2
self.But_Import = QtWidgets.QPushButton(self.groupBox_2)
self.But_Import.setGeometry(5,360,169,30)
self.But_Import.setText("Import")
self.But_Export = QtWidgets.QPushButton(self.groupBox_2)
self.But_Export.setGeometry(176,360,169,30 )
self.But_Export.setText("Export")
#class ImageLabel(QtWidgets.QLabel):
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
Window = MainWindow()
Window.show()
sys.exit(app.exec_())
and the Error
Traceback (most recent call last):
File "D:/NAME/Desktop/fiel/Gen_v1.0.0.2.py", line 47, in <module>
Window = MainWindow()
File "D:/NAME/Desktop/fiel/Gen_v1.0.0.2.py", line 17, in __init__
MainWindow.setWindowTitle("Gen")
TypeError: setWindowTitle(self, str): first argument of unbound method must have type 'QWidget'