Linux-Signal VS QT

Marco marco at waven.com
Thu Feb 8 10:08:18 EST 2007


Can I use LinuX signal as a tool for commuction with a QT(PyQt4) programme?

The follow code didNOT work...


from PyQt4 import QtCore,QtGui
import signal
import sys
import os

try:
    import psyco
    psyco.full()
except:
    pass

class Main(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)

        self.frame = QtGui.QFrame(self)
        self.label = QtGui.QLabel(str(os.getpid()), self.frame)
        signal.signal(15, self.sig_handler)
        print signal.getsignal(15)

    def sig_handler(self, signum, sframe):
        print 'received!'
        self.label.setText('haha')
        self.show()

########################
#	main routine		#
########################
if __name__ == '__main__':
	app = QtGui.QApplication(sys.argv)
	
	main = Main()
	main.show()
	app.exec_()


-- 
LinuX Power



More information about the Python-list mailing list