Daniel Casasampera
Daniel Casasampera

Reputation: 381

Deleting all items of the canvas deletes also the widgets it contains?

I am new at programming and I was wondering if when you delete all items of the canvas you also delete the widgets it contains. I have a canvas with widgets using the create_window method, the canvas is build for the user to fill information, when done the information is saved and the canvas is cleared. Later the canvas ir redrawn for the user to fill again information. When the canvas is build widgets are created so I was wondering: if I only delete the items would I be stacking widgetes over and over somewhere, everytime the canvas is redrawn?

Upvotes: 0

Views: 55

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385980

When you delete a window object on the canvas, only that window object on the canvas is deleted. The widget itself is not automatically deleted. If you only delete the canvas objects and keep creating new windows to be embedded on the canvas, you're creating a memory leak.

Upvotes: 1

Related Questions