If we want to cancel the display of any widget from the screen or top level, then the Forgot forget()
method is used. There are two types of forget method
(similar to forget_pack()
forget ()
) and forget_grid ()
, which are used with pack()
and grid()
method, respectively.
forget_pack ( )
—
Syntax: widget.forget_pack () widget can be any valid widget which is visible.
Code # 1:
|
Exit:
After forgetting
After search
Note the difference in the position of button 1 before and after forgetting, as well as after retrieving.
forget_grid ()
—
Syntax: widget.forget_grid () widget can be any valid widget which is visible.
Note. This method can only be used with geometric methods grid()
.
Code # 2:
|
Output:
After forgetting
After searching
Please note that the position of button 1 remains unchanged after forgetting and fetching . With the grid_forget ()
grid_forget ()
method, you can place it on any grid after retrieving, but the original grid is usually selected.