Skip to content Skip to sidebar Skip to footer

Event Binding To Detect A Grid_remove (Tkinter)

I'm setting up a Tkinter GUI in Python (2.7). There's one place where I plan to create a collection of similar widgets, using grid() and grid_remove() to select which one of them w

Solution 1:

You want to bind to the <Unmap> event. From the official tcl/tk documentation (bind man page):

The Map and Unmap events are generated whenever the mapping state of a window changes.

Windows are created in the unmapped state. Top-level windows become mapped when they transition to the normal state, and are unmapped in the withdrawn and iconic states. Other windows become mapped when they are placed under control of a geometry manager (for example pack or grid).

A window is viewable only if it and all of its ancestors are mapped. Note that geometry managers typically do not map their children until they have been mapped themselves, and unmap all children when they become unmapped; hence in Tk Map and Unmap events indicate whether or not a window is viewable.


Post a Comment for "Event Binding To Detect A Grid_remove (Tkinter)"