Forum Archive

Load image problem

Kluesi

Hi

I load an image on Class Definition:

---SNIP---
Class XYZ (Scene)
board=load_image_file('animage.jpg')
...

def draw(self):
image(self.board,1,1,426,320)
---SNIP---

Here I get a white rect, but no image. I also tried to load the image in "def setup(self):" but I get the same white rect. Only if I load the image directly in the draw procedure just before the image(...) then I get the image.

But is this the right way. I think this draw procedure runs 60 times a second. And so I also load this image 60 times.

How do I load the image the right way.

Thanks Jens

brumm

Pythonista 1.5 example

JonB

it seems here that your problem simply may be that you are calling the image board in one spot, and self.board in another! self.board in both places will avoid issues with scope.