A
A
artshelom2018-10-11 21:44:54
Python
artshelom, 2018-10-11 21:44:54

How to run a file on a window in python?

Sorry for the stupid question, but I don't know how to do it.

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(717, 550)

And I'm trying to run:
import sys
from PyQt5 import QtGui
from output import Ui_MainWindow

def main():
    qApp = QtGui.QApplication(sys.argv)
    aw = Ui_MainWindow()
    aw.show()
    sys.exit(qApp.exec_())

if __name__ == '__main__':
    main()

Mistake:
Traceback (most recent call last):
  File "C:/Users/Nicee/Desktop/Ni/newNu/Main.py", line 3, in <module>
    from output import Ui_MainWindow
  File "C:\Users\Nicee\Desktop\Ni\newNu\output.py", line 11, in <module>
    class Ui_MainWindow(QtGui.QMainWindow):
AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'

I understand that it does not find this attribute. But I do everything like everyone else. But I can't (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2018-10-11
@artshelom

Here is the answer: PyQt5.QtWidgets.QApplication .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question