python - How to determine that every object has been deleted from a Tkinter canvas? -


I am using the tanker to design a snake game. The snake is drawn on a canvas in which the rectangular is used sequentially and it is updated using an alarm callback according to the following conditions:

  def move (self) : #Take the snake #here #Root Up Level Levels self.alarm_id = self.root.after (500, own.)   

A player completing a stage in the game After that I want to remove the snake from canvas using canvas .delete method and advanced facilities Drag the new snake with users.

I tried to do it, but before the old snake canvas is cleared it, the new snake is being pulled, even though I'm operating gradually. Is there any way I can avoid overlap of this operation? As a program, I was thinking of a way of deciding that every rectangle in the old snake has been removed from the canvas. I looked through the documentation, but I have not succeeded so far.

Assuming your canvas is called self.canvas , I think That you can use self.canvas.find_all () , which currently gives a tube of the object on the canvas once it gives an empty tubal, you can draw your next snake Are there.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -