# Верх строка
if self.b1.background_color == color1 and self.b2.background_color == color1 and self.b3.background_color == color1 or self.b1.background_color == color2 and self.b2.background_color == color2 and self.b3.background_color == color2:
winner = self.b1.background_color
return winner
# Центральная строка
if self.b4.background_color == color1 and self.b5.background_color == color1 and self.b6.background_color == color1 or self.b4.background_color == color2 and self.b5.background_color == color2 and self.b6.background_color== color2:
winner = self.b4.background_color
return winner
# Низ строка
if self.b7.background_color == color1 and self.b8.background_color == color1 and self.b9.background_color == color1 or self.b7.background_color == color2 and self.b8.background_color == color2 and self.b9.background_color == color2:
winner = self.b7.background_color
return winner
# Левый столб
if self.b7.background_color == color1 and self.b1.background_color == color1 and self.b4.background_color == color1 or self.b7.background_color == color2 and self.b1.background_color == color2 and self.b4.background_color == color2:
winner = self.b7.background_color
return winner
# Центральный столб
if self.b2.background_color == color1 and self.b8.background_color == color1 and self.b5.background_color == color1 or self.b2.background_color == color2 and self.b8.background_color == color2 and self.b5.background_color == color2:
winner = self.b7.background_color
return winner
# Правый столб
if self.b3.background_color == color1 and self.b6.background_color == color1 and self.b9.background_color == color1 or self.b3.background_color == color2 and self.b6.background_color == color2 and self.b9.background_color == color2:
winner = self.b3.background_color
return winner
# Диагональ справа налево
if self.b1.background_color == color1 and self.b5.background_color == color1 and self.b9.background_color == color1 or self.b1.background_color == color2 and self.b5.background_color == color2 and self.b9.background_color == color2:
winner = self.b1.background_color
return winner
# Диагональ слева направо
if self.b7.background_color == color1 and self.b3.background_color == color1 and self.b5.background_color == color1 or self.b7.background_color == color2 and self.b3.background_color == color2 and self.b5.background_color == color2:
winner = self.b7.background_color
return winner
В любом случае, спасибо за внимание и попытку помочь, всего доброго)