Feb-15-2017, 11:00 AM
Hi,
Following this tutorial: https://bitesofcode.blogspot.co.uk/2011/...3633820729
Once this code it run, the window opens, but there is an error message and the application can't be closed properly i.e. the only way to get out of it is to quit terminal.
The following code is exactly the only difference is the shebang, as I use python3 so use that shebang. I have been working with Qt4 now for a couple of weeks and have not come across this problem before, but I am only just now learning about making sure that only one instance of QApplication is running etc. So there must be something in the code that is causing the problem. Unfortunately I have not found any info on what a display argument is. Any help would be much appreciated.
Following this tutorial: https://bitesofcode.blogspot.co.uk/2011/...3633820729
Once this code it run, the window opens, but there is an error message and the application can't be closed properly i.e. the only way to get out of it is to quit terminal.
The following code is exactly the only difference is the shebang, as I use python3 so use that shebang. I have been working with Qt4 now for a couple of weeks and have not come across this problem before, but I am only just now learning about making sure that only one instance of QApplication is running etc. So there must be something in the code that is causing the problem. Unfortunately I have not found any info on what a display argument is. Any help would be much appreciated.
#!/usr/bin/python3 """ Main entry point to the nexsys application. """ # define authorship information __authors__ = ['Eric Hulser'] __author__ = ','.join(__authors__) __credits__ = [] __copyright__ = 'Copyright (c) 2011' __license__ = 'GPL' # maintanence information __maintainer__ = 'Eric Hulser' __email__ = '[email protected]' from PyQt4 import QtGui def main(argv = None): """ Creates the main window for the nexsys application and begins the \ QApplication if necessary. :param argv | [, ..] || None :return error code """ app = None # create the application if necessary if ( not QtGui.QApplication.instance() ): app = QtGui.QApplication(argv) app.setStyle('plastique') # create the main window QtGui.QMessageBox.information(None, 'Stub', 'Create the Main Window!') # run the application if necessary if ( app ): return app.exec_() # no errors since we're not running our own event loop return 0 if ( __name__ == '__main__' ): import sys sys.exit(main(sys.argv))