[PyQt] SpinBox jam/lock

Mads Ipsen mpi at comxnet.dk
Fri Jan 30 15:05:39 GMT 2009


The following observation occurs on Linux (Ubuntu 8.04) with PyQt-4.4.4 and
qt-4.4.3.

If you connect to the valueChanged signal from a spin box, and the function
you call, take a long time before it returns, the spin box jams and does
several increments of it value. I have included a small snippet below that
reproduces this. Note, if you press ArrowUp or ArrowDown in the spin box's
line edit field, no jamming takes place. 

import sys

from PyQt4 import QtCore, QtGui

def foo(value):
    for i in range(value*100000):
        print value

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)

    widget = QtGui.QSpinBox()
    widget.connect(widget, QtCore.SIGNAL('valueChanged(int)'), foo)

    widget.show()
    sys.exit(app.exec_())


More information about the PyQt mailing list