Math?

More
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.

More
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.

More
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

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

More
19 Jun 2015 18:59 #59988 by mhaberler
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.

More
19 Jun 2015 19:23 #59989 by emcPT
Replied by emcPT on topic Math?
:blush: Ok, my C experience blinded my sight.

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

More
19 Jun 2015 21:22 #59992 by Todd Zuercher
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: mhaberlerHansU
Time to create page: 0.133 seconds
Powered by Kunena Forum