Repository navigation
0.3 cleanup 4/4: demo showcase and README guide - #11
Merged
Merged
Conversation
Every other widget draws dark text by default; white labels were invisible on the light backgrounds most examples use.
One card per widget family with its main options and a one-line API caption, and an event log that shows each callback as it fires. Cards are laid out in one place so a new widget needs one more Card. Add --screenshot PATH to save a frame headlessly, and tests for both modes.
Explain the main loop (Group, handle_event's return value, update(dt), drawing each widget, dropdowns last) and give a short reference for every widget. Show the new demo screenshot and remove the unused logo.
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.
Stacked on #10
Summary
Fourth of four stacked PRs for the 0.3.0 cleanup: the demo is now the living documentation, and the README is a short guide.
src/PygameUIKit/demo.py). A 1100x720 window with a light background and a grid of titled cards. Each card has a one-line API caption.widthwithalign, and a button whosetextchanges on click.IconButton,IconToggle(it animates the chart) and anImageButtonwithhover_imageand text.show_value, plus a keyboard hint.on_change, andon_submit(shows the submitted text).valueandindex.ui.handle_eventreturns False, so it is ignored while typing.Slider.on_change(42). Continuous changes update a single line.Carddataclass (title, caption, rect, draw function) and acell(column, row, columns)grid helper. The layout is one list inDemo.__init__, so adding a widget means adding adraw_<name>method and oneCard. The Dropdown card is drawn last so its menu covers the cards below it.--frames Nis kept. New:--screenshot PATHsaves the last frame as a PNG and exits, using the dummy video driver by default, so no window opens.Labelnow defaults to black text instead of white (only 0.3 cleanup 2/4: Button, ImageButton, IconButton, IconToggle and Label #9 introduced the default; 0.2 required a color). This matches TextInput, Slider and BarChart, and white labels were invisible on light backgrounds. The CHANGELOG is updated.images/img.png, generated with--screenshot). "Use it" now has a runnable main-loop example (Group, thehandle_eventreturn value,update(dt), drawing each widget, dropdowns last), short notes on callbacks, colors and fonts, and a one-bullet reference per widget (constructor, properties, callbacks). Install, Try it and Develop are kept. The unreferencedimages/logo.jpegis removed.Breaking changes
Label's defaultcoloris"black"(it was"white"earlier in this unreleased stack).How tested
uv run ruff check . && uv run ruff format --check . && uv run pytest && uv run pygameuikit-demo --frames 5passes (81 tests). Newtests/test_demo.py:--screenshottotmp_pathand checks its sizeI also checked the visuals by viewing the
--screenshotoutput and a scripted interaction frame: buttons clicked, slider dragged, text typed and submitted, chart randomized, dropdown open with an option highlighted over the event log. I iterated on spacing until nothing overlapped or clipped. I also ran the README example headlessly.