Enthought Canopy - passing sys.argv from PySide Qt program

Posted by user2541559 on Stack Overflow See other posts from Stack Overflow or by user2541559
Published on 2013-10-20T03:51:52Z Indexed on 2013/10/20 3:53 UTC
Read the original article Hit count: 597

Filed under:
|
|

I've recently been looking at the Enthought distro of iPython. Today I decided to see if I could get some Qt GUI progs running and was successful after making minor changes. Simple example:

import sys
from PySide import QtGui    # was 'from PyQT4 import QtGui'

# app = QtGui.QApplication(sys.argv)   -- not needed

win = QtGui.QWidget()

win.resize(320, 240)  
win.setWindowTitle("Hello MIT 6X!") 
win.show()

sys.exit()   # was 'sys.exit(app.exec_())'

But I would like to be able to pass sys.argv in some cases. Most example code I see is in the form of the commented out 'app = ' line above. If I include it, I get 'RuntimeError: A QApplication instance already exists.' Suggestions for passing arguments appreciated.

Nick

© Stack Overflow or respective owner

Related posts about pyside

Related posts about enthought