Hello, > > when I use toDouble() I obtain a data in this format: > > (9.5, True) >
The method definition for "toDouble" in C++ is: QVariant.toDouble(bool *ok=0) The "ok" value will be true if the conversion to a double was successful. Because passing a pointer into a function this way is not "Pythonic," Phil had it return the value and success in a tuple (at least I think that was the motivation). So this means you need to index the first value of the tuple, e.g. value = QVariant.toDouble()[0] > When it should be a float 9.50 (cause like I said, is what I have in DB). > > How can I get it 2 decimals positions? > As Andreas noted in the next post, the decimal places shouldn't matter because it's a double precision floating point value. If you want it to be placed in your data base as a string with two decimal places, then export it to the database with a formatted string. But I'm not sure this is what you're asking. Darryl
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
