def _create_qApp():
 if QtGui.QApplication.startingUp():
  if DEBUG:
   print 'Starting up QApplication'
  global qApp
  qApp = QtGui.QApplication([' '])
  QtCore.QObject.connect(qApp, QtCore.SIGNAL('lastWindowClosed()'), qApp, QtCore.SLOT('quit()'))
  _create_qApp.qAppCreatedHere = True

def _create_qApp ( ) : if QtGui . QApplication . startingUp ( ) : if DEBUG : print 'Starting up QApplication' global qApp qApp = QtGui . QApplication ( [ ' ' ] ) QtCore . QObject . connect ( qApp , QtCore . SIGNAL ( 'lastWindowClosed()' ) , qApp , QtCore . SLOT ( 'quit()' ) ) _create_qApp . qAppCreatedHere = True
only one qapp can exist at a time .