If we want to unmap any widget from the screen or toplevel then
forget() method is used. There are two types of forget method
( similar to
forget() ) and
forget_grid() which are used with
grid() method respectively.
forget_pack() method –
Syntax: widget.forget_pack() widget can be any valid widget which is visible.
Notice the difference in the position of Button 1 before and after forget as well as after retrieval.
forget_grid() method –
Syntax: widget.forget_grid() widget can be any valid widget which is visible.
Note : This method can be used only with
grid() geometry methods.
Notice that the position of Button 1 remains same after forget and retrieval. With
grid_forget() method, you can place it at any grid after retrieval but generally, the original grid is chosen.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course