How to clean the screen on Tkinter?

Asked

Viewed 1,855 times

1

There is a practical way to "clean" a screen by giving a destroy() in all the widgets at once, without having to do it one by one?

  • 1

    Is in a frame or another container? Tried to destroy it? If not, why not create one to contain all widgets who wants to destroy together? I don’t know if you know that these controls destroy all children when they are destroyed.

  • As widgets are divided into several frames. I tried to destroy the frames to try to destroy the widgets that they contain together but nothing happened(it must have been some problem in the code, despite the idle do not accuse any syntax error, I will check). But even so, I would still have to destroy the frames one by one? EDIT: In fact, it was a logical problem, which I already solved. Really lack of attention, rs. But deleting frame by frame in larger programs should give a boring job.

  • 1

    In fact it must be a problem in the code. I think this is the simplest way to do it. Errors like this are not usually syntax. You can put all these frames within another frame which has the function of grouping everything you want to destroy at once.

  • I like this tip, it makes the work much easier, Thank you.

1 answer

1


The basic technique is to create a frame to group all the controls you want to destroy, since each control has the function to destroy all your children. Remembering that you can have frames inside frames and they don’t need to be visible. It’s a way to organize the controls. Then you just need to destroy it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.