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.


    Printing input from textview

    Editorial
    2
    3
    1978
    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.
    • janAaron
      janAaron last edited by

      Hi! I wrote a code to let people write stuff in a box, using ui. However I want the program to output whatever the user types in the textview through the terminal. How do I do that?

      Here is my code:

      import ui
      import console

      def textimput(sender):

      view = ui.View()
      view.name = "yuppy"
      view.background_color = 0.00, 1.00, 1.00
      view.present("sheet")

      text = ui.TextField()
      text.flex = "LRTB"
      text.action = textimput
      view.add_subview(text)
      text.center = (view.width 0.5, view.height 0.5)

      As you can see, I haven't defined the method textimput yet because I don't know how to get the program to put the written text in the terminal.

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

        Use print

        By the way, for posting code to the forums, you will want to start a new line, then type three backticks
        ```
        Then paste your code, then end with three backticks again. Then your code will be formatted like this:

        def textinput(sender):
            print sender.text
        

        For writing variables inside a paragraph, use single backticks, like this.

        Backticks are annoying to get to on ios, you press the ?123 button, then hold the single quote charatcter, then select the one on the left. I created an autocorrect shortcut where three commas in a row get replaced with 3 backticks,

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

          I got print, but what do I print?

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