I want to remove a frame from the main page so I tried to use frame.grid_forget() but it gives me this error: _tkinter.TclError: bad window path name ".!frame" what to do ?
The problem is simple: When you call window.destroy(), the window doesn't exist any more. Therefore, you can't call grid or grid_forget(), because the widget's data is gone.
One suggestion I would make for you to avoid this annoying error would be to use .withdraw(). This way, you can still call the widget's functions, and it will only be minimized.
To bring it back up, use .deiconify().
python tkinter why icant use frame.grid_forget()