-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save_frame()
cannot be called from a mouse or keyboard event function but that works fine in Processing
#394
Comments
I started working on this. The solution is to fallback to Processing's This issue only applies to py5's One shortcoming with what I have coded is that there is reduced functionality in that Processing's Alternatively, py5 could save to a temporary file with Processing's I prefer the alternate solution, but want to hear what others think first. |
My naive solution would be something like this (pseudocode):
|
The issue in py5 isn't the saving, its the getting the pixels that will be saved to the image. Processing's I thought of a better solution than what is above; py5 can save with Processing's |
+PR #415 for this issue Fixed! Now py5 will use Processing's |
From @villares:
Here's what's happening:
py5's
save_frame()
is different from Processing'ssaveFrame()
. py5 uses the PIL image library to save the image, letting you save the image in many formats and all the other nice features PIL has. py5 also lets you save to aBytesIO
object. For these work, it needs to access the frame's pixels, calling Processing'supdatePixels()
method. That call must be triggering that error.The error message should be improved, and if possible, the functionality should be repaired. Ideally this would work.
The
save_frame()
method can tell if it is being called fromdraw()
or not. Then it can fall back to Processing's method instead, or perhaps usepy5_tools.screenshot()
.What about
save()
? Should test that also.Originally posted by @hx2A in #355 (reply in thread)
The text was updated successfully, but these errors were encountered: