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.


    Hide keyboard

    Pythonista
    3
    5
    2279
    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.
    • Webmaster4o
      Webmaster4o last edited by

      If the user clicks into a textfield, how can I force them out of it? A user edits a textfield, then presses a button, which should close the keyboard and take the cursor focus from the textfield.

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

        I also would like to know how to do this. After entering text into a text field, pressing "done" or "enter" ...how to hide the keyboard?

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

          Calling .end_editing() on your text field should do the trick.

          # coding: utf-8
          import time, ui
          
          @ui.in_background
          def show_hide_keyboard(text_view, sleep_secs=1):
              text_view.begin_editing()
              time.sleep(sleep_secs)
              text_view.end_editing()
              time.sleep(sleep_secs)
          
          text_view = ui.TextView()
          text_view.text = str(dir(text_view))
          text_view.font = ('<system-bold>', 20)
          text_view.present()
          for i in xrange(10):
              show_hide_keyboard(text_view)
          
          1 Reply Last reply Reply Quote 0
          • Cook92
            Cook92 last edited by

            Yeah that did it! Thanks!

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

              Thanks!

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