PyQt6 QDoubleSpinBox Error

  • JT
  • JT's Avatar Topic Author
  • Away
  • Administrator
  • Administrator
More
16 May 2024 15:19 #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.
 

JT
 
Attachments:
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
26 May 2024 23:17 #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
:
>>> f'{a:.20f}'



 

Please Log in or Create an account to join the conversation.

Time to create page: 0.148 seconds
Powered by Kunena Forum