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.


    Question on auto-rotation in ui.view

    Pythonista
    ui.view.present
    2
    3
    2476
    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.
    • jimwims
      jimwims last edited by

      I am writing a script for my iPhone using the ui module. I want the view to display in only the portrait orientation and not auto-rotate. I have been using the script in the "Getting Started" documentation to figure out how to do that. From the description of the present() method, I thought changing the last line in that script from "view.present('screen')" to either "view.present('portrait')" or "view.present('full_screen', 'portrait')" would work. Neither did the trick. Any suggestions on how to do this would be appreciated.

      Jim

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

        view.present(orientations=["portrait"]) works for me. I remember that the present method is a bit strange with its arguments - if it gets an unexpected argument value, it silently ignores it (even with obvious errors like incorrect types). In this particular case you need to pass a list of valid orientations, not a single string. I don't remember if the explicit orientations parameter name is necessary, but even if it isn't, it's easier to understand this way.

        1 Reply Last reply Reply Quote 1
        • jimwims
          jimwims last edited by

          Thank you! This solved the problem. The orientations parameter does appear to be necessary.

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