[PyQt] python core dumped

Claudio A. Quezada R. claudio.quezada.r at gmail.com
Wed Aug 8 22:42:34 BST 2007


Hi, i´ve got an "exception thrown from an event handler". I´m working
on two QtableWidget, something like this:

grillaDatos
                 Est_1  Est_2  Est_3
Especie 1       3        0        1
Especie 2       3        4        1
Especie 3       0        9        1

grillaBiometria, inicially empty with 3 columns and 1 row:

     Estacion    Especie   Factor K
1

So, mi function to generate the second QTableWidget (grillaBiometria) is:

    def generarTabBiometria(self):
        grilla = self.ui.grillaDatos
        biometria = self.ui.grillaBiometria

        biometria.clearContents()
        total = 0

        for j in range(grilla.rowCount()):
            especie = QtGui.QTableWidgetItem()
            especie.setText(grilla.verticalHeaderItem(j).text())
            for i in range(grilla.columnCount()):
                if grilla.item(j,i):
                    estacion = QtGui.QTableWidgetItem()
                    estacion.setText(grilla.horizontalHeaderItem(i).text())
                    individuos = int(grilla.item(j,i).text())
                    total += individuos
                    biometria.setRowCount(total)
                    for k in range(total-individuos,total):
                        biometria.setItem(k,0,estacion)
                        biometria.setItem(k,1,especie)

        biometria.resizeColumnToContents(0)
        biometria.resizeColumnToContents(1)

that works the very first time, but when i try to use it at a second
time, it says (on winxp):

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

And if i run the script in ubuntu it says: python core dumped (i don´t
remember textually, but it´s something like it).
I don´t know how "catch this exception" on QApplication notify. Any
ideas or orientations?

Let me say that i´m not a programmer, but it was not trouble to get in
python and PyQt (i knew C and Delphi in past years). I´m with Python
2.5.1, PyQt4 and Qt 4.3.0 (the last binary for Windows released a few
days ago on riverbank).

Thanks in advance.

Claudio



More information about the PyQt mailing list