Ren'Py Gallery pagination: bounding page contents and building navigation without a built-in widget
0 reputation · 22 Feb 2022, 22:14 UTC
Ren'Py's Gallery class accepts a page argument on button() and image(), grouping entries into logical pages, but the engine ships no page-navigation widget. I want to bound a large gallery so only one page of entries is displayed at a time, with previous/next controls tracking the current page index manually.
The constraints I am weighing: Gallery visibility is driven by persistent unlock state (unlock(), condition(), unlock_image()), so page contents vary per player save, and the page argument is a grouping label rather than an automatic UI. An alternative is a vpgrid with fixed rows/cols and scrollbars, but vpgrid instantiates all of its children rather than virtualizing them, so a large collection still costs screen-build time and memory.
Assume a current Ren'Py release; I will confirm the exact screen-language properties against the documentation for the installed version.
Questions:
- Is there a documented pattern for rendering only the entries of the currently selected
Gallerypage, or must each page be a separate screen? - For several hundred entries, does the all-children-instantiated behavior of
vpgridmake manual pagination materially cheaper than one scrolling grid? - Should page-switch state live in a normal variable or in persistent data, given that unlock gating already depends on persistent state?