demo_layout.py
changeset 42 0224ce40792f
parent 41 37b7dfc3eae6
child 45 43b2279b06e1
equal deleted inserted replaced
41:37b7dfc3eae6 42:0224ce40792f
    12         Application.__init__(self)
    12         Application.__init__(self)
    13         self.top.connect('keypress', self.on_top_keypress)
    13         self.top.connect('keypress', self.on_top_keypress)
    14 
    14 
    15         #self.top.borders = (1,1,1,1)
    15         #self.top.borders = (1,1,1,1)
    16 
    16 
    17         vert = VerticalLayout(homogeneous=False)
    17         self.top.layout = VerticalLayout(homogeneous=False)
    18         self.top.layout(vert)
       
    19 
    18 
    20         self.buildrow()
    19         self.buildrow()
    21         self.buildrow(expand=True)
    20         self.buildrow(expand=True)
    22         self.buildrow(expand=True, fill=True)
    21         self.buildrow(expand=True, fill=True)
    23         self.buildrow(homogeneous=True)
    22         self.buildrow(homogeneous=True)
    24         self.buildrow(homogeneous=True, fill=True)
    23         self.buildrow(homogeneous=True, fill=True)
    25         self.buildrow(homogeneous=True, fill=True, spacing=1)
    24         self.buildrow(homogeneous=True, fill=True, spacing=1)
    26         self.buildrow(homogeneous=True, fill=True, spacing=2)
    25         self.buildrow(homogeneous=True, fill=True, spacing=2)
    27 
    26 
    28     def buildrow(self, homogeneous=False, spacing=0, expand=False, fill=False):
    27     def buildrow(self, homogeneous=False, spacing=0, expand=False, fill=False):
    29         horz = HorizontalLayout(homogeneous=homogeneous, spacing=spacing)
       
    30         hbox1 = Container()
    28         hbox1 = Container()
    31         hbox1.sizereq.h = 2
    29         hbox1.sizereq.h = 2
    32         hbox1.layout(horz)
    30         hbox1.layout = HorizontalLayout(homogeneous=homogeneous, spacing=spacing)
    33         self.top.add(hbox1)
    31         self.top.add(hbox1)
    34         for i in range(5):
    32         for i in range(5):
    35             btn = Button('Btn' + str(i) * i * i)
    33             btn = Button('Btn' + str(i) * i * i)
    36             hbox1.add(btn, expand=expand, fill=fill)
    34             hbox1.add(btn, expand=expand, fill=fill)
    37 
    35