omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Getting integers from textfields on button press, how?

    Pythonista
    2
    2
    222
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nickrutkowski
      nickrutkowski last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors