PyQt6 QDoubleSpinBox Error

More
2 years 5 months ago #300758 by JT
Just a heads up for anyone writing their own GUI using PyQt. Tom on the IRC discovered that if you set singleStep(0.1) and have minimum to a negative number and using the arrow to go down until you get a large number from value() then go up to -0.0 the value is a huge exponent number. So what I did was use the Python f string to limit the decimals and that fixed the issue for me.
 

Attachment not found



JT
 

Please Log in to join the conversation.

More
2 years 5 months ago #301534 by Grotius
Replied by Grotius on topic PyQt6 QDoubleSpinBox Error
Hi,

That number is quite normal to see in c or c++. And indeed using a limit on the decimals shows 0.0000
We often call this kind of number expressions : "scientific notations".
1e-6 is a common notation used by me to verify if something is close to zero.

In c++ we use std::fixed to get rid of scientific notations. Python uses
Code:
:
Code:
>>> f'{a:.20f}'



 

Please Log in to join the conversation.

Time to create page: 0.132 seconds
Powered by Kunena Forum