The Damage/Repair Model

Instead of redrawing the contents of a widget every time the underlying data model changes, or every time the window manager sends an “expose” message, collect information about the changes and redraw everything in one step.

The widget can use flags, rectangles or regions, or more advanced data structures to collect damage. The important thing is that the repair handler can use the information to optimize drawing (usually by skipping parts of the widget data model that are not affected by the change).

Also see the Tkinter Performance note.


Using a damage flag

Using a damage rectangle

Using multiple damage flags


A Django site. rendered by a django application. hosted by webfaction.