from threading import Thread from time import sleep from Jeuxdetir(nom provisoire) import * class Pistolet(Thread): def __init__ (self,unx,uny,uncanvas): Thread.__init__(self) self.x=unx self.y=uny self.c=uncanvas self.cote=5 self.r=self.c.create_rectangle(self.x,self.y,self.x+self.cote,self.y+self.cote,fill="#ff0000") def run(self): while self.x>0 and self.x<1900 : if direction==True: self.x=self.x+1 sleep(0.001) self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote) else: self.x=self.x-1 sleep(0.001) self.c.coords(self.r,self.x,self.y,self.x+self.cote,self.y+self.cote) self.c.delete(self.r)