21 self.mouse_widget = None |
21 self.mouse_widget = None |
22 #: If True, tab cycles inside container |
22 #: If True, tab cycles inside container |
23 self.trap_focus = False |
23 self.trap_focus = False |
24 self.layout = layout_class() |
24 self.layout = layout_class() |
25 |
25 |
26 def add(self, widget): |
26 def add(self, widget, *args, **kwargs): |
27 """Add widget into container.""" |
27 """Add widget into container.""" |
28 self._widgets.append(widget) |
28 self._widgets.append(widget) |
29 widget.parent = self |
29 widget.parent = self |
30 widget.window = self.window |
30 widget.window = self.window |
31 widget.set_theme(self.theme) |
31 widget.set_theme(self.theme) |
32 self.layout.add(widget) |
32 self.layout.add(widget, *args, **kwargs) |
33 if self.focus_widget is None and widget.can_focus(): |
33 if self.focus_widget is None and widget.can_focus(): |
34 self.focus_widget = widget |
34 self.focus_widget = widget |
35 |
35 |
36 def resize(self, w, h): |
36 def resize(self, w, h): |
37 Widget.resize(self, w, h) |
37 Widget.resize(self, w, h) |