Exemple #1
0
 def __init__(self,
              items,
              spacing=10,
              align='l',
              equalize='',
              expand=None,
              padding=(0, 0),
              **kwds):
     Frame.__init__(self)
     hpad, vpad = padding
     if expand is not None and not isinstance(expand, int):
         expand = items.index(expand)
     equalize_components(items, equalize)
     width = 0
     for item in items:
         if item:
             width = max(width, item.width)
     y = vpad
     gap = 0
     vanchor = 't'
     hanchor = align
     for i, item in enumerate(items):
         if item:
             y += gap
             if 'l' in align:
                 x = 0
                 if 'r' in align:
                     item.width = width
             elif align == 'r':
                 x = width - item.width
             else:
                 x = (width - item.width) // 2
             item.position = (x + hpad, y)
             if i == expand:
                 item.anchor = 'tb' + hanchor
                 vanchor = 'b'
             else:
                 item.anchor = vanchor + hanchor
             y += item.height
         if i == expand:
             vanchor = 'b'
         gap = spacing
     self.size = (width + 2 * hpad, y + vpad)
     self.add(items)
     self.set(**kwds)
Exemple #2
0
 def __init__(self,
              items,
              spacing=10,
              align='c',
              equalize='',
              expand=None,
              padding=(0, 0),
              **kwds):
     Frame.__init__(self)
     hpad, vpad = padding
     if expand is not None and not isinstance(expand, int):
         expand = items.index(expand)
     equalize_components(items, equalize)
     height = 0
     for item in items:
         if item:
             height = max(height, item.height)
     x = hpad
     gap = 0
     hanchor = 'l'
     vanchor = align
     for i, item in enumerate(items):
         x += gap
         if item:
             if 't' in align:
                 y = 0
                 if 'b' in align:
                     item.height = height
             elif align == 'b':
                 y = height - item.height
             else:
                 y = (height - item.height) // 2
             item.position = (x, y + vpad)
             if i == expand:
                 item.anchor = 'lr' + vanchor
             else:
                 item.anchor = hanchor + vanchor
             x += item.width
         if i == expand:
             hanchor = 'r'
         gap = spacing
     self.size = (x + hpad, height + 2 * vpad)
     self.add(items)
     self.set(**kwds)
 def __init__(self, items, spacing = 10, align = 'l', equalize = '',
         expand = None, padding = (0, 0), **kwds):
     Frame.__init__(self)
     hpad, vpad = padding
     if expand is not None and not isinstance(expand, int):
         expand = items.index(expand)
     equalize_components(items, equalize)
     width = 0
     for item in items:
         if item:
             width = max(width, item.width)
     y = vpad
     gap = 0
     vanchor = 't'
     hanchor = align
     for i, item in enumerate(items):
         if item:
             y += gap
             if 'l' in align:
                 x = 0
                 if 'r' in align:
                     item.width = width
             elif align == 'r':
                 x = width - item.width
             else:
                 x = (width - item.width) // 2
             item.position = (x + hpad, y)
             if i == expand:
                 item.anchor = 'tb' + hanchor
                 vanchor = 'b'
             else:
                 item.anchor = vanchor + hanchor
             y += item.height
         if i == expand:
             vanchor = 'b'
         gap = spacing
     self.size = (width + 2 * hpad, y + vpad)
     self.add(items)
     self.set(**kwds)
Exemple #4
0
 def __init__(self, items, spacing=10, align="c", equalize="", expand=None, padding=(0, 0), **kwds):
     Frame.__init__(self)
     hpad, vpad = padding
     if expand is not None and not isinstance(expand, int):
         expand = items.index(expand)
     equalize_components(items, equalize)
     height = 0
     for item in items:
         if item:
             height = max(height, item.height)
     x = hpad
     gap = 0
     hanchor = "l"
     vanchor = align
     for i, item in enumerate(items):
         x += gap
         if item:
             if "t" in align:
                 y = 0
                 if "b" in align:
                     item.height = height
             elif align == "b":
                 y = height - item.height
             else:
                 y = (height - item.height) // 2
             item.position = (x, y + vpad)
             if i == expand:
                 item.anchor = "lr" + vanchor
             else:
                 item.anchor = hanchor + vanchor
             x += item.width
         if i == expand:
             hanchor = "r"
         gap = spacing
     self.size = (x + hpad, height + 2 * vpad)
     self.add(items)
     self.set(**kwds)