samedi 9 juillet 2016

How to clear Tkinter Canvas?


When I draw a shape using:

canvas.create_rectangle(10, 10, 50, 50, color="green")

Does Tkinter keep track of the fact that it was created?

In a simple game I'm making, my code has one Frame create a bunch of rectangles, and then draw a big black rectangle to clear the screen, and then draw another set of updated rectangles, and so on.

Am I creating thousands of rectangle objects in memory?

I know you can assign the code above to a variable, but if I don't do that and just draw directly to the canvas, does it stay in memory, or does it just draw the pixels, like in the HTML5 canvas?


Aucun commentaire:

Enregistrer un commentaire