Math?
- Todd Zuercher
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 4987
- Thank you received: 1455
19 Jun 2015 18:24 - 19 Jun 2015 18:58 #59985
by Todd Zuercher
Math? was created by Todd Zuercher
Is it possible to create a spinbutton where you can do some basic math (add, subtract, multiply, divide)? Such as say the box currently has a value of 6.500, I would like to be able to move the cursor to the end of the number, type +1.125, press enter and have the value of the box change to 7.625. Another example would be inputting fractional measurements such as 10+11/16, press enter and the value would show 10.6875.
Last edit: 19 Jun 2015 18:58 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
- emcPT
-
- Offline
- Platinum Member
-
Less
More
- Posts: 702
- Thank you received: 139
19 Jun 2015 18:39 #59986
by emcPT
Replied by emcPT on topic Math?
That would require a math parser behind it = a lot of code.
Please Log in or Create an account to join the conversation.
- BigJohnT
-
- Offline
- Administrator
-
Less
More
- Posts: 7000
- Thank you received: 1175
19 Jun 2015 18:40 #59987
by BigJohnT
Replied by BigJohnT on topic Math?
Yes, you can do that in the Python handler. I think Andy has done that on one of his GUI's. I've done it in Python. IIRC you use the activate signal to call your handler. I'll see if I can find an example.
JT
JT
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
-
Less
More
- Posts: 195
- Thank you received: 11
19 Jun 2015 18:59 #59988
by mhaberler
no it would not: lmgtfy.com/?q=python+eval+math+expression
Replied by mhaberler on topic Math?
That would require a math parser behind it = a lot of code.
no it would not: lmgtfy.com/?q=python+eval+math+expression
Please Log in or Create an account to join the conversation.
- emcPT
-
- Offline
- Platinum Member
-
Less
More
- Posts: 702
- Thank you received: 139
19 Jun 2015 19:23 #59989
by emcPT
Ok, my C experience blinded my sight.
Replied by emcPT on topic Math?

Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 4987
- Thank you received: 1455
19 Jun 2015 21:22 #59992
by Todd Zuercher
Thanks John,
Looking forward to seeing an example.
Replied by Todd Zuercher on topic Math?
Yes, you can do that in the Python handler. I think Andy has done that on one of his GUI's. I've done it in Python. IIRC you use the activate signal to call your handler. I'll see if I can find an example.
JT
Thanks John,
Looking forward to seeing an example.
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.063 seconds