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.
Open .gif or image in Safari?
-
@dgelessus You're right but if I ask Pythonista to convert it into Python3, it uses http.server and the script has an execution error...
-
-
I am staying in Python 2. I have come so far in my learning and Python 3 seems to throw a wrench in it. :)
-
My error, conversion 2 to 3 is ok but I had left the #!python2 line, shame on me 😢
-
@donnieh another option might be encoding as a data: url.
-
@JonB Is there a code example doing something similar?
-
stupid question... but what are you trying to achieve? Why not use the internal browser for this?
-
@JonB I have an app almost ready to go on the AppStore. It is full of animated electronic circuit diagrams. If I added a feature for the gif diagram to be opened up in Safari, without much work I could have the save to camera roll, pinch to zoom, Workflows, and other share/extension functionality etc that safari has.
I do understand Pythonista can do all this, but I was going to do the Safari way for now to save time. Otherwise, I will suck it up and do all the in app code.
I will try the Objectice-C method. I very well could try the built in web browser, I can't argue that.
P.S. I also just realized imageview now animates gifs as where I don't think it worked a few years ago ( I think...).
-
If you want the user to be able to view, save and share the file, you could also use
console.quicklook
,console.open_in
, ordialogs.share_image
. Especiallyconsole.quicklook
is very similar to what you would also achieve with Safari, with the advantage that you don't have to leave the app. -
And you have also webview
import ui import os class MyView(ui.View): def __init__(self,w,h): self.width = w self.height = h wv = ui.WebView(frame=(0,0,w,h)) doc_path = os.path.expanduser('~/Documents') file_path = os.path.join(doc_path,'IMG_5126.JPG') # your file name of course wv.load_url('file://'+file_path) self.add_subview(wv) #w, h = ui.get_screen_size() w, h = (540,620) back = MyView(w, h) back.present('sheet')
-
Ok! That's sound legit. Thank you!