I was making a game copy of Space Invaders but when I went to do the "shot" of the ship, I came across a problem:
AsseenintheGif,whenIhitthekey,everythingonthecanvas"freezes" until the shot reaches the end, how do I solve it? Thank you in advance.
Code snippet:
def Update (self):
while True :
self.Move_nave()
self.root.update()
self.root.after(30)
def Shot (self, event):
self.a_0 , self.a_2 = int(self.c.coords (self.bola)[0]), int(self.c.coords (self.bola)[2])
self.a_1, self.a_3 = int (self.c.coords(self.bola)[1]), int (self.c.coords(self.bola)[3])
self.tiro = self.c.create_rectangle(self.a_0 + 10, self.a_1, self.a_2 - 10, self.a_3, fill = 'blue')
for c in range (10):
self.c.move(self.tiro, 0, -10)
self.root.after(40)
self.root.update_idletasks()