def insert(self, i, control, **kwargs): """ Inserts the control, or inserts all controls in the given Layout. """ if isinstance(control, Layout): # If the control is actually a Layout (e.g. ordered group of controls), apply it. control.apply(**kwargs) Layer.insert(self, i, control)
def insert(self, i, control): """ Inserts the control, or inserts all controls in the given Layout. """ if isinstance(control, Layout): # If the control is actually a Layout (e.g. ordered group of controls), apply it. control.apply() Layer.insert(self, i, control)
def __init__(self, **kwargs): """ A group of controls with a specific layout. Controls can be added with Layout.append(). The layout will be applied when Layout.apply() is called. This happens automatically if a layout is appended to a Panel. """ kwargs["x"] = kwargs["y"] = kwargs["width"] = kwargs["height"] = 0 Layer.__init__(self, **kwargs) self._controls = {} # Lazy cache of (id, control)-children, see nested().
def __init__(self, x=0, y=0, **kwargs): """ A group of controls with a specific layout. Controls can be added with Layout.append(). The layout will be applied when Layout.apply() is called. This happens automatically if a layout is appended to a Panel. """ kwargs["width"] = 0 kwargs["height"] = 0 Layer.__init__(self, x=x, y=y, **kwargs) self._controls = {} # Lazy cache of (id, control)-children, see nested().
def __init__(self, x=0, y=0, id=None, **kwargs): """ Base class for GUI controls. The Control class inherits from Layer so it must be appended to the canvas (or a container) to receive events and get drawn. An id can be given to uniquely identify the control. If the control is part of a Panel, it can be retrieved with Panel.control_id. """ Layer.__init__(self, x=x, y=y, **kwargs) self.id = id self.src = {} # Collection of source images. self.enabled = True # Enable event listener. self.duration = 0 # Disable tweening. self._controls = {} # Lazy index of (id, control) children, see nested(). self._press = None
def origin(self, x=None, y=None, relative=False): return Layer.origin(self, x, y, relative)
def layer_at(self, x, y, clipped=False, enabled=False, transformed=True, _covered=False): return Layer.layer_at(self, x, y, clipped, enabled, False, _covered)
def _draw(self): Layer._draw(self)
def insert(self, i, control): if isinstance(control, Layout): # If the control is actually a Layout, apply it. control.apply() Layer.insert(self, i, control)
def insert(self, i, control): if isinstance(control, Layout): control.apply() # If the control is actually a Layout, apply it. Layer.insert(self, i, control)