I'm new to Pythonista's ui module and I wonder if anybody else has seen this problem:
I have a small program with a simple .pyui view file. The program loads the view and tries to put an image into the imageView object in the view:
view = ui.load_view()
imageView = view['imageview1']
imageView.load_from_url('http://i3.kym-cdn.com/photos/images/newsfeed/000/404/302/597.gif')
view.present()
This works great the first time the program is run. However, when the program is run a second time, the entire Pythonista app freezes. I need to halt Pythonista and start it again to continue.
I thought it might be a network issue, even though it only happens every second attempt. So I saved the image to a (very long) data URL encoded with Base64. Again, the program works the first time, but not the second time.
If I comment out the call to load_from_url()
, the rest of the program will work fine.
I tried using an image in a much shorter URL, just in case size was the issue:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
However, the program exhibited the same problem.
Should my program do some clean-up before it exits or before the image is loaded?
Update: Here's a simple single-file program that demonstrates the problem:
import ui
view = ui.View()
image = ui.ImageView()
image.load_from_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==')
view.add_subview(image)
view.present()