• paulwb


    I'm glad I found Pythonista; it is a very neat piece of software indeed. This is a rather basic question, so I appreciate your patience.

    I am trying to get back into programming and to learn Python by doing the same things that got me started with programming many years ago: I want to draw an image pixel by pixel. I understand that it is usually very slow to actually update each pixel using a Scene or Canvas method, so I am prepared to work on my bytearray (or other type of object) and then display the final result to the screen.

    The value of each pixel is generated algorithmically, so I do not need shape primitives, I don't need animation and I just need to do one screen update.

    Since I don't need animation, it sounds like I should stay away from Scene. However, the Drawing Bitmap Images section of the Canvas documentation doesn't help me much:

    canvas.draw_image(image_name, x, y[, width, height])
    Draws the image with the given name in a rectangle. If width and height are omitted, the image is drawn at its natural size.

    How can I generate an object that is of the type that canvas.draw_image takes in its first argument? Where can I find an exact specification of what type of object this is, how to pack pixel information into it and so on?

    Thank you and my apologies if this question is more closely related to packages included in Pythonista rather than about Pythonista itself.



    posted in Pythonista read more
  • paulwb

    ccc, I apologize, I did not see your comment. I never formally measured the time taken, but I did end up with the impression that the speed was "good enough".

    brumm, thank you very much for the tip on how to create individual pixels. After a few days of tinkering, finding odd moments here and there to tap away in Pythonista, I recreated the Mandelbrot Set from memory. It's been years and years since I last played with fractals.


    This gave me the confidence to carry on with Python and generated images on my main computer:


    That one took about 8 hours, I think (with completely un-optimized code, running on one core only).

    Anyway, thank you all for the help!

    posted in Pythonista read more
  • paulwb

    Why yes! Thank you very much for that. I played with the code a little bit last night, but I haven't been able to draw a conclusion on whether or not it is fast enough. I will update tonight.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!