Next / Previous / Contents / Shipman's homepage

4.1. How it works

Every widget (except the root window) has a parent. However, the child widget does not actually appear on the screen until it is gridded with the .grid() method.

So, to give the illusion that many different pages can appear in the same space, each page inside a PageTurner is a single child widget of its .bodyFrame attribute, but only one is gridded at any given time.

The first time a new page widget is added to a PageTurner by calling its .addPage() method, the new page is gridded inside the .bodyFrame at row 0, column 0, at which point it appears on the screen.

From then on, whenever we want to present a different page, we can make the current page invisible by calling its .grid_forget() method. This removes that child from the screen, but it is still registered as a child of .bodyFrame, and can be put back anytime by calling its .grid() method. (In this respect .grid_forget() differs from .grid_remove(), which destroys the child widget altogether.)