Once your GUIs start getting more complex, you have to use the global application
instantiation and global windows variables.
If you don't use both the global application instantiation and global windows variables,
then the resultant GUI will appear and disappear very quickly as Python cleans up its
local variables.
import sys
import PyQt4 as qt
app=None
win=None
global app
global win
app = qt.QApplication(sys.argv)
win = qt.QLabel("Hello world!",None)
win.show()
windo()
you can’t have more than one qt.QApplication(sys.argv) running at once.
In your second example, you are using pumpThread which works around defining the app in a bad way, but then you re-define it the way that doesn't make maya happy.
Perhaps just comment out the app= line in the second example.
They can all call pumpThread, since this is protected from starting more than once.