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.


    Help with screen sizes

    Pythonista
    11
    23
    23511
    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.
    • dgelessus
      dgelessus last edited by

      @donnieh You might want to double-check the rotations. The iPad mini resolutions seem to be in portrait, but the iPad Air and Pro resolutions in landscape. Also, are these physical pixels or virtual "points"? For example, the iPhone 3GS and 4 have the same number of "points", but the iPhone 4 has four times the pixels, because one "point" is made up of four pixels (because retina).

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

        Has anyone ever hacked with MacTracker's url scheme like:

        import webbrowser
        webbrowser.open('mactracker://ABA79B4E-3781-4053-8D73-AC46D16CE643')
        

        http://blog.mactracker.ca/2006/11/link-to-mactracker-from-other-apps.html. This (Mac or iOS) app will give you all of the speeds and feeds for every product that Apple has ever made. The only problem is that the url scheme is 10 years old and a bit long in the tooth. To open the stats page on a particular model, you need that model's UUID which I can find in the app but not elsewhere. Opening the url merely opens the MacTracker app to the right page but does not return any model back to the caller (Pythonista). It would be pretty awesome if the app would accept iPad5,4 in the inbound url instead of a model uuid and would return a json dict of speeds and feeds for that particular model..

        1 Reply Last reply Reply Quote 2
        • donnieh
          donnieh @AtomBombed last edited by

          @AtomBombed ui.get_screen_size() returns a 2-tuple, (w, h) of the current device's screen size.

          Nothing related to pixel location etc.

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

            @dgelessus Good catch. I fixed them to all be in Portrait. Yeah these are points which are clusters of pixels. I do not know how the points are derived though. Apple determines this?

            Screen "point count" (not resolution) retuned from ui.get_screen_size() - (width, height) all in PORTRAIT

            iPhone4_screen_size = (320, 480)
            iPhone4s_screen_size = (320, 480)
            iPhone5_screen_size = (320, 568)
            iPhone5s_screen_size = (320, 568)
            iPhone6_screen_size = (375, 667)
            iPhone6P_screen_size = (414, 736)
            iPhone6s_screen_size = (375, 667)
            iPhone6sP_screen_size = (414, 736)
            iPad2_screen_size = (768, 1024)
            iPad_Mini_1 = (768, 1024)
            iPad_Mini_2 = (768, 1024)
            iPad_Mini_3 = (768, 1024)
            iPad_Air_screen_size = (768, 1024)
            iPad_Air_2_screen_size = (768, 1024)
            iPad_Pro_screen_size = (1024, 1366)

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

              So, it actually looks like iPad mini 1 is the same size as 2 and 3. This is confusing to me, though, because iPad mini 2 and three have retina screens while the first generation does not

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

                @Webmaster4o yes this is a good point, one that @dgelessus referred to above. The terms "Retina", "resolution" and marketing numbers like 2732 x 2048 (264 ppi) (for the iPad Pro) seem to have nothing to do with ui.get_screen_size().

                These are all referring to the amount of pixels. While if we could somehow programmatically get the the amount of pixels in x and the amount of pixels in the y it would be useful, I do not know how to do this. Using ui.get_screen_size() returns "points". These points are clusters of pixels. Using the points is fine for determine screen size as far as I seen though.

                This article is helpful. http://www.idev101.com/code/User_Interface/sizes.html

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

                  get screen size always returns the same size regardless of orientation,etc. But the maz size of the view depends on whether you are fullscreen, sheet, or panel, and whether you are hiding the title bar.

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

                    In the scene module you find scene.get_screen_scale()
                    "Return the scale factor of the current device’s screen. For retina screens this will usually be 2.0 or 3.0, and 1.0 for non-retina screens."

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

                      A small example. With a retina display you should see three lines.

                      import ui, scene
                      
                      scale = scene.get_screen_scale()
                      with ui.ImageContext(100, 100) as ctx:
                      	ui.set_color('white')
                      	ui.fill_rect(0, 0, 100, 100)
                      	ui.set_color('black')
                      	ui.fill_rect(0, 3, 100, 2)
                      	ui.set_color('black')
                      	ui.fill_rect(0, 7, 100, 1)
                      	if scale > 1:
                      		ui.set_color('black')
                      		ui.fill_rect(0, 10, 100, 1 / scale)
                      	img = ctx.get_image()
                      	img.show()
                      
                      1 Reply Last reply Reply Quote 1
                      • ExParrot
                        ExParrot last edited by

                        scrSize=(1136,640) # iPhone 5 (dots)

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

                          This is my 30-minute utility that should be useful. It's an editor action that can put blank files for any iOS device in your current working directory.

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

                            Added 32-bit vs. 64-bit and Retina display multiplier https://github.com/cclauss/Ten-lines-or-less/blob/master/pythonista_version.py

                            Pythonista version 2.0.1 (201000) on iOS 9.2.1 on a 64-bit iPad5,4 with a screen size of (1024 x 768) * 2

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