| 299 | self.canvas.itemconfig(other.item_id, fill=otherfill) |
| 300 | |
| 301 | def compareto(self, other): |
| 302 | myfill = self.canvas.itemcget(self.item_id, 'fill') |
| 303 | otherfill = self.canvas.itemcget(other.item_id, 'fill') |
| 304 | if self.value < other.value: |
| 305 | myflash = 'white' |
| 306 | otherflash = 'black' |
| 307 | outcome = -1 |
| 308 | elif self.value > other.value: |
| 309 | myflash = 'black' |
| 310 | otherflash = 'white' |
| 311 | outcome = 1 |
| 312 | else: |
| 313 | myflash = otherflash = 'grey' |
| 314 | outcome = 0 |
| 315 | try: |
| 316 | self.canvas.itemconfig(self.item_id, fill=myflash) |
| 317 | self.canvas.itemconfig(other.item_id, fill=otherflash) |
| 318 | self.array.wait(500) |
| 319 | finally: |
| 320 | self.canvas.itemconfig(self.item_id, fill=myfill) |
| 321 | self.canvas.itemconfig(other.item_id, fill=otherfill) |
| 322 | return outcome |
| 323 | |
| 324 | def position(self): |
| 325 | x1 = (self.index+1)*XGRID - WIDTH//2 |