#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ˅
from tkinter import *
from behavioral_patterns.mediator.colleague import Colleague

# ˄


class ColleagueButton(Colleague):
    # ˅

    # ˄

    def __init__(self, button):

        # Flag indicating whether the button is pressed
        self.__is_pressed = False

        self.__button = button

        # ˅
        super().__init__()
        self.__button.bind('<ButtonPress-1>', self.__on_mouse_pressed)
        self.__button.bind('<ButtonRelease-1>', self.__on_mouse_released)
        # ˄

    # Set enable/disable from the Mediator
    def set_activation(self, is_enable):
        # ˅
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)
        # ˄

    def is_pressed(self):
        # ˅
        return self.__button['state'] != DISABLED and self.__is_pressed
        # ˄

    def __on_mouse_pressed(self, event):
        # ˅
        self.__is_pressed = True
        # ˄

    def __on_mouse_released(self, event):
        # ˅
        self.mediator.colleague_changed()
        self.__is_pressed = False
        # ˄

    # ˅

    # ˄


# ˅

# ˄

cd4a017814261d8d5651e87edf884b2c1ce2d76d
<mask token>


class ColleagueButton(Colleague):
    <mask token>

    def set_activation(self, is_enable):
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)

    def is_pressed(self):
        return self.__button['state'] != DISABLED and self.__is_pressed
    <mask token>

    def __on_mouse_released(self, event):
        self.mediator.colleague_changed()
        self.__is_pressed = False

<mask token>


class ColleagueButton(Colleague):

    def __init__(self, button):
        self.__is_pressed = False
        self.__button = button
        super().__init__()
        self.__button.bind('<ButtonPress-1>', self.__on_mouse_pressed)
        self.__button.bind('<ButtonRelease-1>', self.__on_mouse_released)

    def set_activation(self, is_enable):
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)

    def is_pressed(self):
        return self.__button['state'] != DISABLED and self.__is_pressed
    <mask token>

    def __on_mouse_released(self, event):
        self.mediator.colleague_changed()
        self.__is_pressed = False

<mask token>


class ColleagueButton(Colleague):

    def __init__(self, button):
        self.__is_pressed = False
        self.__button = button
        super().__init__()
        self.__button.bind('<ButtonPress-1>', self.__on_mouse_pressed)
        self.__button.bind('<ButtonRelease-1>', self.__on_mouse_released)

    def set_activation(self, is_enable):
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)

    def is_pressed(self):
        return self.__button['state'] != DISABLED and self.__is_pressed

    def __on_mouse_pressed(self, event):
        self.__is_pressed = True

    def __on_mouse_released(self, event):
        self.mediator.colleague_changed()
        self.__is_pressed = False

from tkinter import *
from behavioral_patterns.mediator.colleague import Colleague


class ColleagueButton(Colleague):

    def __init__(self, button):
        self.__is_pressed = False
        self.__button = button
        super().__init__()
        self.__button.bind('<ButtonPress-1>', self.__on_mouse_pressed)
        self.__button.bind('<ButtonRelease-1>', self.__on_mouse_released)

    def set_activation(self, is_enable):
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)

    def is_pressed(self):
        return self.__button['state'] != DISABLED and self.__is_pressed

    def __on_mouse_pressed(self, event):
        self.__is_pressed = True

    def __on_mouse_released(self, event):
        self.mediator.colleague_changed()
        self.__is_pressed = False

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ˅
from tkinter import *
from behavioral_patterns.mediator.colleague import Colleague

# ˄


class ColleagueButton(Colleague):
    # ˅

    # ˄

    def __init__(self, button):

        # Flag indicating whether the button is pressed
        self.__is_pressed = False

        self.__button = button

        # ˅
        super().__init__()
        self.__button.bind('<ButtonPress-1>', self.__on_mouse_pressed)
        self.__button.bind('<ButtonRelease-1>', self.__on_mouse_released)
        # ˄

    # Set enable/disable from the Mediator
    def set_activation(self, is_enable):
        # ˅
        if is_enable:
            self.__button.configure(state=NORMAL)
        else:
            self.__button.configure(state=DISABLED)
        # ˄

    def is_pressed(self):
        # ˅
        return self.__button['state'] != DISABLED and self.__is_pressed
        # ˄

    def __on_mouse_pressed(self, event):
        # ˅
        self.__is_pressed = True
        # ˄

    def __on_mouse_released(self, event):
        # ˅
        self.mediator.colleague_changed()
        self.__is_pressed = False
        # ˄

    # ˅

    # ˄


# ˅

# ˄
