Skip to content

Say when get_image and get_pixel can read the screen - #2961

Merged
pvcraven merged 1 commit into
developmentfrom
docs-screenshot-timing
Oct 9, 2026
Merged

pvcraven merged 1 commit into
developmentfrom
docs-screenshot-timing

Conversation

@pvcraven

@pvcraven pvcraven commented Oct 9, 2026

Copy link
Copy Markdown
Member

Summary

Closes #1342 with a docstring note on arcade.get_image() and arcade.get_pixel(). The change is 7 lines in arcade/screenshot.py.

Call this at the end of on_draw, after drawing. Once a frame has been shown, such as in on_key_press, the screen's contents are undefined and may read as black.

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:

  • Right after drawing, inside the frame: get_image() returns the drawing.
  • After the frame is shown: it returns an all-black image.

Nothing in the docstrings warned about this. The get_image example's comment now says "At the end of on_draw".

The rest of #1342

  • Coordinates: pushfoo's concern that get_image used a top-left origin is already fixed. It uses the bottom left and handles pixel ratio.
  • Not added: a 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

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>
@pvcraven
pvcraven merged commit 1dc1bb6 into development Oct 9, 2026
7 checks passed
@pvcraven
pvcraven deleted the docs-screenshot-timing branch October 9, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build improved screenshot API

1 participant