Forum Archive

Getting integers from textfields on button press, how?

nickrutkowski

I've been learning python for about 2 weeks. I installed pythonista to try and create a program that takes numbers from the user and does a bunch of stuff to it. I have the math for the numbers and the button to make it go, but I cannot figure out how to get integers in from a text box.

In short I'm trying to get input1 * (input2 + input3 +1) = number of dice to roll.

ccc

In Examples/User Interface/Calculator.py the button_tapped() function gets the values of label1 and label2.

For your code, you will need to use int(sender.superview['label1']) to get an integer.