tuikit/core/container.py
author Radek Brich <radek.brich@devl.cz>
Mon, 17 Mar 2014 23:44:18 +0100
changeset 87 ee5ea9671f28
parent 77 tuikit/container.py@fc1989059e19
child 89 94f5baef19ac
permissions -rw-r--r--
Add core Widget, Container. Add widgets Label.

class Container:

    """Container for widgets."""

    def __init__(self):
        #: List of child widgets.
        self.children = []

    def add(self, widget, **kwargs):
        """Add widget into container."""
        self.children.append(widget)
        widget.parent = self
        widget.window = self.window if hasattr(self, 'window') else self

    def draw(self, buffer, x=0, y=0):
        """Draw child widgets."""
        for child in self.children:
            child.draw(buffer,
                       x + child.x,
                       y + child.y)