• upwart

    There is pretty neat Python 3.7 implementation, called Pyto.
    It supports numpy, matplotlib and ... pandas!
    I just wished it had the same Scene interface as Pythonista or even better supported tkinter or pygame.

    posted in Pythonista read more
  • upwart

    I have looked at PyTo and it certainly looks promising.
    But I like Pythonista more, I think.

    posted in Pythonista read more
  • upwart

    @cvp
    Well, that's maybe the way to go, although I prefer to stick with my old fashioned scene_drawing code.

    Thanks just the same.

    posted in Pythonista read more
  • upwart

    Now that I can display the built up picture (as a SpriteNode), I run into another problem. In my scene.draw method, I now update the SpriteNode's texture and then I want to draw some rectangles and texts with the scene_drawing primitives rect and text.
    Unfortunately these do not show up at all, as if they are hidden behind the SpriteNode. I tried to set the SpriteNode's z_position to -1, but that doesn't help.
    So my concrete question is: "How can I show the scene_drawing results in front of the SpriteNode?".

    posted in Pythonista read more
  • upwart

    @JonB
    The PIL image is created for each frame by combining several (sometimes hundreds or thousands) small PIL images. For non-retina resolution it is easy to show them in a scene event loop. For retina resolution I have to escape to a SpriteNode which is filled with a texture for each and every frame.

    posted in Pythonista read more
  • upwart

    @mikael
    I just found out that if change the file format from PNG to BMP speeds up the animation significantly: from 4 to > 16 fps.

    posted in Pythonista read more
  • upwart

    @mikael
    Thank you so much for the code you provided.
    Based on that I have made a small proof of concept in which I let your rectangle shrink with one point on every draw().
    I do that by just changing the texture of self.bg.
    That works excellent.
    I suppose due to the overhead of

            im.save(fp, 'PNG')
            img = ui.Image.from_data(fp.getvalue(),scale)
    

    , I can reach just 4 frames per second.
    Not ideal, but enough for me to try and implement it in my salabim package.

    Thanks a lot.

    posted in Pythonista read more
  • upwart

    @mikael
    Here are the answers to your questions:

    If you create and display the image as you show, image quality is not sufficient
    Sometimes it is not sufficient and then double resolution would be helpful

    If you use a full-scale image, only one quarter of the image is shown?
    Yes, that's true.

    You are committed to using scene
    Yes, because I use the same code base for tkinter I have to rely on a PIL images that are shown in a loop.

    Do you have some fps requirement?
    Not really, because my package automatically corrects for missed frames, but as it is an animation, there are some performance requirements, for sure.

    posted in Pythonista read more
  • upwart

    I can see the screen scale.
    But how do I put a Pillow image to a scene in pixels and not points?

    posted in Pythonista read more
  • upwart

    @mikael
    Essentially my code is

                    capture_image = Image.new("RGB", (1122, 834, (0, 0, 0))
                   #  build up the image with Pillow
                    ims = scene.load_pil_image(capture_image)
                    scene.image(ims, 0, 0, *capture_image.size)
                    scene.unload_image(ims)
    

    This results (on an iPad Pro 10.5") in a full screen picture.

    I would like to double the resolution, so build a Pillow image of 2244 x 1668 pixels and then copy that to the screen.

    Any idea how to do that?

    By the way, this is part of a much bigger open source simulation library that supports animation on both tkinter and Pythonista platforms. If you are interested have a look at www.salabim.org, where you will find the link to the GitHub repository.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!