Repository navigation
docs: document that drawImage needs a display mode set - #50
Merged
Merged
Conversation
drawImage converts the loaded image to the display's pixel format, so it raises pygame.error when no display mode has been set, even when the instance is bound to an off-screen surface. The other draw methods work in that state. Document it in the docstring and README and pin it with a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs say drawImage is the only draw method that needs a display mode set, so exercise drawButton in that state as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (anchored on CI run 38365016372, green on 3.9–3.13, and a local
Finding fixed during review:
Judgment call flagged for the maintainer: the requirement could be removed instead of documented, for example by skipping This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
drawImagecallsconvert_alpha()on the loaded image, which raisespygame.error: No video mode has been setwhenpygame.display.set_modehas not been called. This happens even when theGraphikis bound to an off-screen surface.drawRectangleanddrawTextwork in that state, as was confirmed empirically before the change.drawImagedocstring'sRaises:section mentionedpygame.erroronly for undecodable files, and the README said nothing about the requirement. Both now document it.drawImageraisespygame.errorwithout painting anything. After a mode is set, the same instance draws the image, so the failure caches nothing.No production behavior is changed. Only the docstring, the README and the tests are modified. Removing the requirement (for example, by converting against the bound surface when no display exists) would be a behavior change and is left for a separate decision.
Test plan
python3 -m py_compile src/main/python/preponderous/graphik/graphik.pypython3 -m pytest -q: 61 passed (headless viaconftest.py)-k requires_a_display_mode), so it does not depend on state left by earlier testsSkipped issues
No tracking issue exists. The gap was found during a documentation-accuracy sweep (Stage A). The open issues were left alone for these reasons:
.github/workflows/or the release process, which are excluded from autonomous change and wait on a maintainer decision.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson