I've discovered a very irritating hang-up bug. The following code demonstrates it:
import ui v = ui.View() im = ui.ImageView() im.load_from_url('http://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg') im.flex = 'LRTBWH' v.add_subview(im) v.present()
Simply run this, then exit, then run again. Pythonista will hang up the second time. The only way to fix it is to multitask and force pythonista to close. This was happening in a larger program. I've fixed it in my program by loading images separately and then viewing the data (slower and lengthy code).
Smaller bug: If you start running from landscape mode, neither portrait or landscape UI will have the little clock bar at the top, causing the dimensions to be different than if you started from portrait.
Also, if there was a way to have an action run on orientation change, that would be great. Currently I have an "ori" ButtonItem at the top that recalculates the frames based on the parent frame dimensions, and it has to be manually pushed.
@henryiii Regarding orientation... you could avoid the button by testing the orientation in a loop or on a timer. A hidden web view gives a way. See the post... http://omz-forums.appspot.com/pythonista/post/5828332964806656
You can also use a combination of layout and keyboard frame will change... see http://omz-forums.appspot.com/pythonista/post/5836666543538176
Edit: ... and for screen (not device) orientation... without using a WebView... see http://omz-forums.appspot.com/pythonista/post/4524755898073088
@henryiii This looks like it could give you a workaround....
import ui def Load(): im.load_from_url('http://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg') v = ui.View() im = ui.ImageView() #im.load_from_url('http://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg') im.flex = 'LRTBWH' v.add_subview(im) v.present() ui.delay(Load, 0)
I'm having the same exact issue. I've tried everything within my means to debug, and it's simply not a logical error.
Tony, your solution doesn't seem to me like it will work because the hang up happens right when it gets to the load_from_url(). How would delaying it by zero seconds help?
Is this an issue with object staying in memory after the script has been run and done with?