<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi,<br><br>This is regarding the precision in "QDoubleSpinBox". With out sub classing things were not working as I expected.<br>&nbsp;&nbsp;&nbsp; <br><br>class QxDoubleSpinBox(QtGui.QDoubleSpinBox):<br>&nbsp;&nbsp;&nbsp; def __init__(self, parent=None, value=0.):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QtGui.QDoubleSpinBox.__init__(self, parent)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setRange(0., 1.)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setValue(0.421)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setSingleStep(0.001)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setFixedWidth(70)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setWrapping(True)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 self.setDecimals(3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; def valueFromText(self, str):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return FixedPoint(str, 3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; def textFromValue(self, value):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "textFromValue = ", value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return str(value)<br><br><br>As soon as I start the application, here are the results printed:<br>&nbsp;&nbsp;&nbsp; <br><br>textFromValue =&nbsp; 0.42<br>textFromValue =&nbsp; 0.42<br>textFromValue =&nbsp; 0.42<br>textFromValue =&nbsp; 0.0<br>textFromValue =&nbsp; 1.0<br>textFromValue =&nbsp; 0.42<br>textFromValue =&nbsp; 0.42<br><br><br>I have no idea what's going on here and why "textFromValue" is getting called so many times with values getting changed each time. I was hoping that sub classing
 will solve the problem of precision.<br><br>How do I solve this? <br><br>Prashant<br><br>qt-sdk-win-opensource-2009.03.1.exe<br>Python 2.6.3<br>PyQt-Py2.6-gpl-4.6-1<br>Win XP, 32 Bit <br></div></div><br>
      <!--3--><hr size=1></hr> From cricket scores to your friends. Try the <a href="http://in.rd.yahoo.com/tagline_metro_4/*http://in.yahoo.com/trynew" target="_blank">Yahoo! India Homepage!</a></body></html>