python garbage collection doing it's work. "test" is dying after the function is finished and your UI is automatically closed. You need a global to keep it alive.
On Wed, May 2, 2012 at 9:16 AM, Panupat Chongstitwattana <[email protected] > wrote: > Maya 2012 x64 on Windows here. Here's a simple class loading the ui file. > > class UI(QtGui.QMainWindow): > def __init__(self, parent=None): > QtGui.QWidget.__init__(self, parent) > self.ui = uic.loadUi(PATH) > > If I execute these command on their own, the UI shows up no problem. > > test = loginUI() > > test.ui.show() > > > But if I wrap those in a function, the UI would show up for an instant and > closes itself. > > def testui(): > test = loginUI() > test.ui.show() > testui() > > What could be the cause of it? Am I missing something? > Thanks > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- David Moulder http://www.google.com/profiles/squish3d -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
