Add __repr__ for QColor?
Adam Gausmann
AdamG at esdemc.com
Wed Apr 5 18:49:50 BST 2023
On Tue, Apr 4, 2023 at 8:18 PM RoadrunnerWMC <roadrunnerwmc at gmail.com> wrote:
>
> The float constructor lets you specify more accurate values, but since the components aren't stored as floats, the rounding makes it kind of gross:
>
> >>> QtGui.QColor.fromRgbF(0.5, 0.5, 0.501)
> PyQt6.QtGui.QColor.fromRgbF(0.5000076293945312, 0.5000076293945312, 0.5009994506835938)>
>
Using a formatting specifier like `{:.6f}` to truncate it to 5 or 6
digits will make that look nicer, since that's the amount of precision
provided by the 16-bit storage.
More information about the PyQt
mailing list