Python – How to get the GUI to display in Spyder

ipythonpyqtpythonspyder

I'm new to creating GUI's in Python and can't seem to get over the first hurdle.
I'm using Anaconda – Spyder and I normally run all (mainly mathematical) code through this (and the IPython console?).

My issue is that when I run the code below I'm expecting it to display a simple blank window but nothing happens.

Is Spyder/IPython not the best way to do this or is there an issue with my code?

I've tried using the command prompt by typing "python TestScript.py" whilst in the correct directory but I get an error saying 'Python is not recognised as a internal or external command'. Do I need to set up cmd to use Anaconda?

import sys

from PyQt5.QtWidgets import QApplication, QWidget

if __name__ == '__main__':

    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(250,150)
    w.move(30,30)
    w.setWindowTitle('Simple Window')
    w.show

    sys.exit(app.exec_())

Best Answer

Clearing this one up, as the answer was posted in the comments by Patrick Artner.

Simply adding () after w.show solved the problem.