• Peter S

    @cvp Of course not, the whole code worked, it only needed a bit of pumping up the image. Thanks again!

    posted in Pythonista read more
  • Peter S

    Fantastic view from wall to wall. Thank you very much!
    And you're right, the site is pretty slow. Nevertheless, good answers are always in time...

    posted in Pythonista read more
  • Peter S

    Here the same result with your code for the imageview. When I bypass GifInView and load a png in my pyui with r['imageview1'].image = ui.Image.named('./gif/image.png'), the picture fills the whole frame.

    Succes, looking forward to a solution!

    posted in Pythonista read more
  • Peter S

    Part of the py:

    class GifInView(ui.View):
        def __init__(self,view,gif_file):
            self.ImageView = ui.ImageView()
            self.add_subview(self.ImageView)
            self.pil = Image.open(gif_file)
            wi,hi = self.pil.size
            wiv = view.width
            hiv = wiv * hi / wi
            self.frame = (0,0,wiv,hiv)
            view.add_subview(self)
            # In a GIF file, each frame has its own duration
            # assume here all frames have the same duration 
            self.update_interval = self.pil.info['duration']/1000
            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.ImageView.content_mode = ui.CONTENT_SCALE_TO_FILL
            self.frame_id = self.frame_id + 1
            if self.frame_id >= self.pil.n_frames:
                self.frame_id = 0
    
    
    # knop regenradar
    def knopje(sender):
        uri = 'https://api.buienradar.nl/image/1.0/radarmapnl/gif/?hist=0&forc=36&width=550&l=1&step=1'
        with open('./gif/radar.gif', 'wb') as f:
            f.write(requests.get(uri).content)
        r = ui.load_view('Radar')
        if ui.get_screen_size()[1] >= 768:
            r.present('sheet')
        else:
            r.present()
        GifInView(r['imageview1'],'./gif/radar.gif')
    

    The link to the gif:
    link text

    The result is an animated gif displayed, but too small for the imageview (about 1/4th).

    posted in Pythonista read more
  • Peter S

    @cvp I pasted class GitToView into my program, made an imageview, downloaded an animated gif and displayed it. It works, the animation runs fine. But...

    The gif is about 450 x 450 px, the imageview as well, the displayed version is about one/third of the original. When I move the x,y of the imageview, the gif moves with it.

    I don't understand what happens in the class, so I can't solve the problem. Can you point out what I'm doing wrong? Thanks.

    posted in Pythonista read more
  • Peter S

    @cvp Thank you for both tips. The second one would make it possible to see the raindrops fall. I’ll think about that 😀

    posted in Pythonista read more
  • Peter S

    @cvp The result: [https://scheelpj.home.xs4all.nl/Weer.jpg](link url)

    Thanks again!

    posted in Pythonista read more
  • Peter S

    @cvp It works! With gifs as well. Thank you very much, your answer was very clear.

    posted in Pythonista read more
  • Peter S

    Hi,

    I'm new to Python and to Pythonista. I'm working on a program that fetches data and put the results in a view. I made a design in the UI Editor, it consists labels for textual results and Image Views for icons.

    My problem is to put icons in the Image Views. I have a map consisting gifs. An ImageView icon points to the IOS images like alert_24 (the !). Can I redirect it to my map of gifs?

    To put text in a label I use: v['label1'].text = placeDate
    Can I do something similar to put icon therm.gif in imageview9?

    Thank you very much for your help,

    Peter

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!