[PyQt] QSpinBox: behavior on Linux
TP
paratribulations at free.fr
Thu Jun 4 16:53:53 BST 2009
Hi everybody,
I have detected a strange behavior on Linux with QSpinBox (try the code
example below): when the "valueChanged( int )" signal is connected to a
function that takes some time to execute, sometimes the "up" and "down"
clickable buttons of the QSpinBox increment and decrement its value by 2 or
more, instead of 1. Whereas on Windows it works correctly. Could you try
under Linux and confirm the strange behavior?
I have another question: why does the value of the spinbox change only after
the function has been executed? How to force the spinbox value to change
immediately, and call the function to be executed AFTER?
My version of PyQt: PyQt-x11-gpl-4.4.4
My version of Qt: 4.4.0.
Thanks
##########
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys, time
app = QApplication( sys.argv )
dialog = QDialog( )
# dialog.setBackgroundRole( 9 )
dialog.resize( 750, 550 )
def wait_a_moment():
# pass
time.sleep( 0.5 )
spinbox = QSpinBox( dialog )
QObject.connect( spinbox
, SIGNAL( "valueChanged ( int )" )
, wait_a_moment )
vboxlayout = QVBoxLayout( dialog )
dialog.setLayout( vboxlayout )
dialog.show()
app.exec_()
##########
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
More information about the PyQt
mailing list