from tkinter import * class Lumememm: def __init__(self, x, y, ala): self.x=x self.y=y self.ala=ala self.d=20 self.joonista() def joonista(self): self.peapall=ala.create_oval(self.x, self.y, self.x+self.d, self.y+self.d) self.kehapall=ala.create_oval(self.x, self.y+self.d, self.x+self.d, self.y+2*self.d) self.jalapall=ala.create_oval(self.x, self.y+2*self.d, self.x+self.d, self.y+3*self.d) def liiguta(self, dx, dy): self.x+=dx self.y+=dy self.ala.coords(self.peapall, self.x, self.y, self.x+self.d, self.y+self.d) self.ala.coords(self.kehapall, self.x, self.y+self.d, self.x+self.d, self.y+2*self.d) self.ala.coords(self.jalapall, self.x, self.y+2*self.d, self.x+self.d, self.y+3*self.d) aken=Tk() ala=Canvas(aken) ala.pack() memm1=Lumememm( 50, 100, ala) memm2=Lumememm(150, 100, ala) memm2.liiguta(0, 20) aken.mainloop()