• cvp

    I know we can display an animated gif via a WebView
    see
    but I wanted to display it into an Image, thus...
    try this little imperfect script
    if you tap on the gif, it will stop or restart

    PS sorry if already done

    from PIL import Image
    import ui
    import io
    
    class Gif(ui.View):
        def __init__(self,gif_file,duration):
            self.duration = duration
            self.ImageView = ui.ImageView()
            self.add_subview(self.ImageView)
            self.pil = Image.open(gif_file)
            self.update_interval = self.duration / self.pil.n_frames
            self.frame_id = 0
        def pil2ui(self,imgIn):
            with io.BytesIO() as bIO:
                imgIn.save(bIO, 'PNG')
                imgOut = ui.Image.from_data(bIO.getvalue())
            del bIO
            return imgOut
        def update(self):
            # Display individual frames from the loaded animated GIF file
            self.pil.seek(self.frame_id)
            self.ImageView.image = self.pil2ui(self.pil)
            self.frame_id = self.frame_id + 1
            if self.frame_id >= self.pil.n_frames:
                self.frame_id = 0
        def touch_ended(self,touch):
            if self.update_interval == 0:
                self.update_interval = self.duration / self.pil.n_frames
            else:
                self.update_interval = 0
    
    if __name__ == '__main__':
        v = Gif('dog left to right.gif',1)
        v.present('sheet')#,hide_title_bar=True)
    

    posted in Pythonista read more
  • cvp

    @Sabarblatoe Even so, I don't see the image in the UI designer, only when I run the script.
    I did not reinstall the app.

    posted in Pythonista read more
  • cvp

    @Sabarblatoe example of custom attributes in UI designer:

    {'background_image':ui.Image.named('IMG_6066.PNG')}
    

    Or

    {'image':ui.Image.named('IMG_6066.PNG'). with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)}
    

    But you only will see the effect when you run your script, not at design time

    posted in Pythonista read more
  • cvp

    Personally, I use FTP to access my NAS

    posted in Pythonista read more
  • cvp

    @kami Sorry it I can't help, I don't know anything about Xcode...

    posted in Pythonista read more
  • cvp

    @Phuket2 I've corrected a serious error 😂

    posted in Pythonista read more
  • cvp

    @Phuket2 No freeze but not used a lot...

    posted in Pythonista read more
  • cvp

    @Phuket2 Immediately integrated in my apps/tools

    posted in Pythonista read more
  • cvp

    @paul-b Ok for me also with last Pythonista and IOS versions on a iPad Mini 4...

    Using script of @Phuket2 :

    ('pythonista_ver_str', '3.2')
    ('pythonista_ver_num', '320000')
    ('ios_ver_str', '11.2.5')
    ('screen_resoultion', Size(768.00, 1024.00))
    ('screen_scale', 2.0)
    ('machine_architecture', '64bit')
    ('machine_model', 'iPad5,1')

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!