Python: removing a TKinter frame

前端 未结 4 1152
走了就别回头了
走了就别回头了 2021-02-06 07:35

I want to remove a frame from my interface when a specific button is clicked.

This is the invoked callback function

def removeMyself(self):
    del self
         


        
4条回答
  •  余生分开走
    2021-02-06 08:34

    To remove, call either frm.pack_forget() or frm.grid_forget() depending on whether the frame was packed or grided.

    Then call frm.destroy() if you aren't going to use it again, or hold onto the reference and repack or regrid when you want to show it again.

提交回复
热议问题