def __init__(self, text="", elements=None, normal_params=None, press_params=None, finish=True): """Pressable element.""" self.press_params = init_params(press_params) super(Pressable, self).__init__(text, elements, normal_params, finish=False) # painters if not press_params or not "painter" in press_params: painter = copy(self.normal_params.params.get("painter")) if not painter: painter = painterstyle.DEF_PAINTER(size=style.SIZE) painter.pressed = True self.press_params.params["painter"] = painter ## self.set_painter(painterstyle.DEF_PAINTER(size=style.SIZE)) # reactions self._set_press_reaction(parameters.BUTTON_PRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON}) self._set_unpress_reaction(parameters.BUTTON_UNPRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON}) if finish: self.finish()
def __init__(self, text="", elements=None, normal_params=None, press_params=None): """To modify _press and _unpress reaction, assign new self._reaction_press and self._reaction_unpress functions !""" self.press_params = init_params(press_params) super(Pressable, self).__init__(text, elements, normal_params) # fusionner self.set_painter(painterstyle.DEF_PAINTER(size=style.SIZE)) # reactions self._set_press_reaction(parameters.BUTTON_PRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON}) self._set_unpress_reaction(parameters.BUTTON_UNPRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON})
def __init__(self, elements=None, normal_params=None, finish=True): """ Element of an application that have no graphical existence, though its children might be graphicals. This is the base class for all the Elements. <elements>: list of the children elements. """ self.get_size = self.get_fus_size self.surface = display.get_surface() if not elements: elements = [] self.normal_params = init_params(normal_params) """State can be anything useful for user""" self._reactions = [] self._blit_before = [] self._blit_after = [] # elements whose this reacter instance is an element self.father = None # init elements self._elements = [] self.add_elements(elements) # init _states self._states = {} self._states[constants.STATE_NORMAL] = _GhostState() self.current_state = self._states[constants.STATE_NORMAL] self.current_state_key = constants.STATE_NORMAL # init user function self.visible = False self.user_func = self.normal_params.params.get("user func") self.user_params = self.normal_params.params.get("user params", {}) self.active = True self._finished = False self._jail = None self._lock_jail = False self.rank = constants.DEFAULT_RANK self.click_quit = None self._lift = None self._jail = None self._overframe = None #used for shadows. Indicate that element can clip outside of its parent's clip self._is_in_family = True self.message = None self.id = Ghost._current_id Ghost._current_id += 1 if finish: self.finish()
def __init__(self, text="", elements=None, normal_params=None, press_params=None): """Pressable element.""" self.press_params = init_params(press_params) super(Pressable, self).__init__(text, elements, normal_params) # painters if not press_params or not "painter" in press_params: painter = copy(self.normal_params.params.get("painter")) if not painter: painter = painterstyle.DEF_PAINTER(size=style.SIZE) painter.pressed = True self.press_params.params["painter"] = painter ## self.set_painter(painterstyle.DEF_PAINTER(size=style.SIZE)) # reactions self._set_press_reaction(parameters.BUTTON_PRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON}) self._set_unpress_reaction(parameters.BUTTON_UNPRESS_EVENT, {"button": parameters.LEFT_CLICK_BUTTON})
def __init__(self, elements=None, normal_params=None): """ Element of an application that have no graphical existence, though its children might be graphicals. This is the base class for all the Elements. <elements>: list of the children elements. """ if not elements: elements = [] self.normal_params = init_params(normal_params) """State can be anything useful for user""" self._reactions = [] self._blit_before = [] self._blit_after = [] # elements whose this reacter instance is an element self.father = None # init elements self._elements = [] self.add_elements(elements) # init _states self._states = {} self._states[constants.STATE_NORMAL] = _GhostState() self.current_state = self._states[constants.STATE_NORMAL] self.current_state_key = constants.STATE_NORMAL # init user function self.visible = False self.user_func = self.normal_params.params.get("user func") self.user_params = self.normal_params.params.get("user params", {}) self.active = True self._finished = False self._jail = None self._lock_jail = False self.rank = constants.DEFAULT_RANK self.click_quit = None self._lift = None self._jail = None self._overframe = None #used for shadows. Indicate that element can clip outside of its parent's clip self._is_in_family = True self.id = Ghost._current_id Ghost._current_id += 1
def __init__(self, elements=None, normal_params=None): if not elements: elements = [] self.normal_params = init_params(normal_params) """State can be anything useful for user""" self._reactions = [] self._blit_before = [] self._blit_after = [] # elements whose this reacter instance is an element self.father = None # init elements self._elements = [] self.add_elements(elements) # init _states self._states = {} self._states[constants.STATE_NORMAL] = _GhostState() self.current_state = self._states[constants.STATE_NORMAL] self.current_state_key = constants.STATE_NORMAL # init user function self.visible = False self.user_func = self.normal_params.params.get("user func") self.user_params = self.normal_params.params.get("user params", {}) self._active = True self._finished = False self._jail = None self._lock_jail = False self.rank = constants.DEFAULT_RANK self.click_quit = None self._bar = None self._bartarget = None #element of which self is the bar self._lift = None self._jail = None self._overframe = None self._is_in_family = True self.id = Ghost._current_id Ghost._current_id += 1