[PyKDE] trouble with QLabel
Rick van Hattem
Rick.van.Hattem at fawo.nl
Tue Jan 9 03:27:36 GMT 2007
On Monday 08 January 2007 10:29, Steven James Samuel Stapleton wrote:
> Thank you, I tried that along with adding the "self." in front of the
> items, and explicitly putting them in the class but I still get the same
> #same to here
> class about(qt.QWidget):
> _l = None
> _p = None
> def __init__(self, app):
> self._l = qt.QLabel("""
> This is the Specs and Item generator for VAR.
> This program is desiged to help create specs and
> items in the VAR system.
> Written by James Stapleton
> """, self)
> #the interveining up to here is also the same, the next line has been
> fixed, I decided to explicitly
> #pass app rather than make it global.
> qt.QObject.connect(self._p, qt.SIGNAL("clicked()"), app,
> #and the ending is the same
> ----- Original Message -----
> From: "Rick van Hattem" <Rick.van.Hattem at fawo.nl>
> To: <pykde at mats.imk.fraunhofer.de>
> Cc: "Steven James Samuel Stapleton" <stapleton at mps.ohio-state.edu>
> Sent: Monday, January 08, 2007 2:08 AM
> Subject: Re: [PyKDE] trouble with QLabel
> > On Monday 08 January 2007 03:52, Steven James Samuel Stapleton wrote:
> > > RuntimeError: Underlying C/C++ object has been deleted
> > >
> > > What could cause this?
> > Exactly what is telling you, the object has been deleted ;)
> > Try saving the object before using it.
> > self.label = qt.QLabel() would work.
> > label = qt.QLabel() does not work since that's a local function, after
> > the function has finished it will be deleted by the garbage collector.
Because I don't have all your code I wasn't able to make it exactly the same
but the following code works fine over here:
# -*- coding: utf-8 -*-
from PyQt4 import Qt as qt
#same to here
'''Instantiate the parent object too'''
'''Creating the label'''
This is the Specs and Item generator for VAR.
This program is desiged to help create specs and
items in the VAR system.
Written by James Stapleton
#the interveining up to here is also the same, the next line has been
fixed, I decided to explicitly
#pass app rather than make it global.
qt.QObject.connect(self, qt.SIGNAL("clicked()"), self.hide)
#and the ending is the same
if __name__ == '__main__':
app = qt.QApplication(sys.argv)
app_about_popup = about()
Rick van Hattem Rick.van.Hattem(at)Fawo.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070109/052935b7/attachment.bin
More information about the PyQt