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
-
@AtomBombed ui.get_screen_size() returns a 2-tuple, (w, h) of the current device's screen size.
Nothing related to pixel location etc.
-
@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) -
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
-
@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
-
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.
-
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." -
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()
-
scrSize=(1136,640) # iPhone 5 (dots)
-
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.
-
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