[PyKDE] threading.Thread and core dump

Janez Jere janez.jere at void.si
Thu Mar 28 14:07:56 GMT 2002


Hello,

I need help with the following code which cause a core dump on mouse event
(click)
I must use threading.Thread because  my older code uses it.

Thanks, Janez

platform:
==============
redhat 7.2
PyQt 3.1
qt 2.3.1
python 2.1.2

#!/usr/bin/python

import sys
from qt import *
import time
import threading

class MyWidget(QWidget):
    def __init__(self,parent=None,name=None):
        QWidget.__init__(self,parent,name)

       self.aTimer = QTimer(self,'fake timer')
        self.connect(self.aTimer, SIGNAL('timeout()'), self.aTimerTimeout)

    def aTimerTimeout(self):
        return


def run():
    while 1:
        time.sleep(0.2)
        QThread.postEvent(w.aTimer, QTimerEvent(1))


appl = QApplication(sys.argv)
w = MyWidget()
w.setGeometry(100,100,500,355)

appl.setMainWidget(w)
w.show()

t = threading.Thread(target=run)
t.setDaemon(1)
t.start()
appl.exec_loop()





More information about the PyQt mailing list