Repository navigation
Say when get_image and get_pixel can read the screen - #2961
Merged
Merged
Conversation
Once a frame has been shown, such as in on_key_press, the screen's contents are undefined: on Windows, get_image() returned an all-black image there. Both docstrings now say to call them at the end of on_draw, after drawing (#1342). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1342 with a docstring note on
arcade.get_image()andarcade.get_pixel(). The change is 7 lines inarcade/screenshot.py.Why
Saving a screenshot is already a one-liner,
arcade.get_image().save("screenshot.png"). But the obvious beginner code calls it from a key press, after the frame has been shown. I tested it on Windows:get_image()returns the drawing.Nothing in the docstrings warned about this. The
get_imageexample's comment now says "At the end of on_draw".The rest of #1342
get_imageused a top-left origin is already fixed. It uses the bottom left and handles pixel ratio.save_screenshot()helper and the screenshot manager, queueing and event extras. The one-liner covers saving, and nobody has asked for the extras since 2022.🤖 Generated with Claude Code