Open dschreij opened 9 years ago
Hi Daniel,
Yes, that seems like a useful addition. As you say, it should be included in the canvas
back-end, perhaps as a screenshot()
or screen_capture()
method. To me, save_as_file()
is a bit ambiguous, because it could also mean that you're pickling the object.
If you want to add this, please use the ising
branch, which is where all the new functionality should go. Or, if this is still too unstable to be useful, you can work from heisenberg
, but I will still merge it into ising
.
You know what the routine is for modifying the backends?
openexp._canvas.canvas.canvas
, and then override this method in all backends that support it.buffer
keyword is applicable to all backends--it's just that not all backends can save the front buffer, so they should raise an osexception
when buffer=u'front'
(I'm not sure, actually, but that's what your implementation suggests).safe_decode()
, imported from libopensesame.py3compat
to make sure it's a unicode object.Cheers! Sebastiaan
Ok, thanks for the explanation. I'll see what I can do in the near future!
I needed this function again recently and came across this post, which I had completely forgot. Is this still relevant enough to implement in the OS Canvases themselves?? Has anything changed regarding your instructions on how to integrate this with the OpenSesame code base?
Has this been implemented? It does not show up in the doc.
@mariansauter This hasn't been implemented yet. There's still a PR open (#658 ) but it has gone off the radar. I don't think @dschreij has time for this currently, but if someone (you?) feels like picking this up and properly testing it against the loewenfeld
branch then perhaps we can still merge it?
(Feature request)
Several times in the past I have found it necessary to save the contents of a canvas to an image file (i.e. make a screenshot). I wrote a function for this, that I copy paste each time, but I think it might be of added value to integrate this function in the OpenSesame canvas object, especially since all backends offer this functionality natively and it is just a matter of passing a few commands (and do some checks if saving the file is possible of course). Here is the code that does the saving:
My idea would be that this function is contained in the canvas object (so this does not need to be passed as the first parameter). To call this function, one could simply do:
What do you think? (maybe you can think of a more appropriate name than 'save_af_file')