On Friday 14 July 2006 19:21, Dave S wrote:
> Hi all,
>
> I am trying to get to grips with QT, putting a friendly face on some of my
> apps :) Its early days and my first attempt but I expected the following to
> print 'hi it works' every second.
>
> There problem I am stuck with is ...
>
> The debugged program raised the exception unhandled RuntimeError
> "underlying C/C++ object has been deleted" At line 24
>
> ie "self.timer = self.startTimer(1000)". First of all I did not have an
> assignment ie I just had "self.startTimer(1000)" realising Python would
> garbage collect I added an assignment but still the same problem.
>
> Also I am struggling with "QObject.connect(self.tickerevent,
> PYSIGNAL("ticker"), self.hello)" I am unsure of what the source of the
> connect is - I suspect my guess of self.tickerevent is wrong. The source of
> the event should be PYSIGNAL("ticker") ?
>
> Any ideas or suggestions much appreciated
>
> Cheers
>
> Dave
>
> ** MY QT MASTERPIECE :) **
>
>
> import sys
> from qt import *
> from frm_livedata import frm
>
>
> class Ticker(QObject):
>
>       def __init__(self):
>               QObject.__init__, (self)
>               self.timer = self.startTimer(1000)
>
>       def timerEvent(self, ev):
>               self.emit(PYSIGNAL("ticker")())
>               QObject.connect(self.tickerevent, PYSIGNAL("ticker"), 
> self.hello)
>
>       def hello():
>               print 'hi it works'
>
> x=Ticker()
>
> if __name__ == '__main__':
>
>       app = QApplication(sys.argv)
>       win = frm()
>       app.setMainWidget(win)
>       win.show()
>       QObject.connect(app, SIGNAL('lastWindowClosed()'),app, SLOT('quit()'))
>       app.exec_loop()
>
>
>
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor

Doh - Sorted it rearranged the defs &  '__init__,' becomes '__init__' its 
always the simple things that eat the hours :) 

I am writting a QT front end displaying some information about my demon 
script 'live_datad.py'. The QT display now comes up (cheer!) but I need a 
couple of things ,,.

First I need to know if if a 'live_datad' is running - Already tried looking 
in modules & os.system('ps ax') no go. I need an equivalent of ps ax | grep 
live_datad.

Second I need to get some simple data from the daemon, no more than 2-3 
strings would do it reflecting the daemons status. I don't want to re-code it 
in classes, or do anything with sockets (they seem way too complex for me) is 
there a more elegant way than the daemon writing its status in an ascii file 
every few seconds and my QT app reading it - or is this an OK way of doing 
it ?

Dave







 
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to