[PyKDE] Stuck newbie
david at boddie.org.uk
Mon Oct 9 22:35:32 BST 2006
On Monday 09 October 2006 09:41:59 +0200, Johannes Graumann wrote:
> Can somebody please give me a hint why the amateurish code below segfaults?
> What am I doing wrong and how to fix it?
> class ElNotes:
> def __init__(self,args):
> self = QtGui.QApplication(args)
> self.maindialog = uic.loadUi("ElNotes_GUI.ui")
> def _connectSlots(self):
> if __name__=="__main__":
> ElNotes = ElNotes(sys.argv)
It's slightly unusual to use a class to enter the main loop like this,
but there's nothing actually wrong with this approach. The problem may
be that you're reassigning self in the __init__() method, and the class
doesn't inherit from QApplication.
It would be more correct to subclass QApplication instead:
self.maindialog = uic.loadUi("ElNotes_GUI.ui")
I haven't actually tried this out, but it should work. Let us know whether
it did or not.
More information about the PyQt