Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] load image from any path (not only pool)

edited June 2015 in OpenSesame

Is there any way to load an image to a canvas from another path which is not the pool?

why?

I see that the createCanvas-> copyFromOtherCanvas ->drawSomething-> showCanvas takes a lot, specially if the canvas I am copying from has lots of elements. I saw instead that if I load a static image instead of copying the canvas is much more faster. So basically I wanted to:

canvas1=self.offline_canvas()
canvas2=self.offline_canvas()
canvas1.copy(exp.items['mysketchpad']
canvas1.text("some new text")
canvas1._canvas.save("c:\\temp\canvas1.png")
canvas2.image(loadSomeHow"c:\\temp\canvas1.png",x=0,y=0)
canvas2.show()

thanks!

Comments

  • edited 8:14AM

    Hi,

    Is there any way to load an image to a canvas from another path which is not the pool?

    Yes, there is a way and it is super straightforward. Actually, you have it already. This line:
    canvas2.image(loadSomeHow"c:\\temp\canvas1.png",x=0,y=0) should do the trick ( Of course if you remove the "loadSomeHow" part).

    However, the canvas.save function is new to me. I haven't known that it exists. If it does, you could alternatively also fetch the path of the filepool and save your screenshots to that location, so that you can load them from there:

    path = exp.pool_folder

    Good luck,

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.