예제 #1
0
    def add(self,items,options=None,**kws):
        """
        Adds one or more components. The parameter comp may be either a single
        component, or a sequence of components. In the latter case, all the
        components will be added.

        The opts parameter containes an Options object (see below) which gives
        information about how the object should be laid out. These options can
        be overridden with keyword arguments, and all this information will be
        passed to the LayoutManager (see below) of the Frame, if any. This
        LayoutManager is stored in the layout property.

        Note that different layout managers may have different
        expectations about **kwds, and may impose restrictions on the
        contents of items
        """

        items = flatten(items)

        # Now add to self._contents.
        for component in items:
            # _set_container() adds component to self._contents.
            # layout manager may have already called it, though.
            if component not in self._contents:
                component._set_container(self)

        # Inform the layout manager, if any.
        if self._layout:
            self._layout.add(items,options,**kws)
예제 #2
0
파일: Menus.py 프로젝트: ProgVal/Manygui
 def add(self,items,index=None):
     if index is None:
         index = len(self.contents)
     items = flatten(items)
     for item in items:
         self.contents.insert(index,item)
         index = index+1
         item.container = self
     self.push('contents')
예제 #3
0
파일: Frames.py 프로젝트: ProgVal/Manygui
    def add(self,items,options=None,**kws):
        """
        Add the given items to this container, passing the items and
        the keyword arguments along to the layout manager, if one is
        present. Note that different layout managers may have
        different expectations about **kwds, and may impose
        restrictions on the contents of items. See LayoutManagers.py.
        """
        items = flatten(items)

        # Now add to self.contents.
        for component in items:
            if component not in self.contents: # @@@ Hm. Shouldn't this be changed to _contents?
                component.container = self
                self.contents.append(component)

        # Inform the layout manager, if any.
        if self.layout:
            self.layout.add(items,options,**kws)
            self.resized(0,0)