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.


    Programatically retrieve device on which the script is running

    Pythonista
    3
    4
    2204
    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.
    • honekamp
      honekamp last edited by

      Please pardon me if this topic has already been discussed, but is there any way to programatically find out whether a script is running on an iPhone or on an iPad and make the script behave accordingly?

      Thank you,

      Uwe

      mikael 1 Reply Last reply Reply Quote 0
      • mikael
        mikael @honekamp last edited by

        @honekamp, googled ”pythonista device info” and found this.

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

          sys.platform gives 'ios' in pythonista.
          platform.machine() returns the hardware, such as Ipad3,3 on my devuce, and probably the iphone version on others.

          Of course, you can also checkui.screen_size.

          honekamp 1 Reply Last reply Reply Quote 2
          • honekamp
            honekamp @JonB last edited by

            @JonB Thanks for the hint, platform.machine() does the job for me. I read about it in the documentation and falsely assumed that this was about the processor architecture. Should have given it a try.

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