demo_anchorlayout.py
changeset 71 cfd3445107b4
parent 62 2f61931520c9
child 76 fa5301e58eca
equal deleted inserted replaced
70:db2eab0beb45 71:cfd3445107b4
    39         label_margin = Label(str(self.win.hints['margin']))
    39         label_margin = Label(str(self.win.hints['margin']))
    40         label_margin.name = 'label_margin'
    40         label_margin.name = 'label_margin'
    41         label_margin.add_handler('draw', self.on_label_margin_draw)
    41         label_margin.add_handler('draw', self.on_label_margin_draw)
    42         win.add(label_margin, halign='center', margin=Borders(t=6))
    42         win.add(label_margin, halign='center', margin=Borders(t=6))
    43 
    43 
       
    44         label_size = Label(str(self.win.sizereq))
       
    45         label_size.name = 'label_size'
       
    46         label_size.add_handler('draw', self.on_label_size_draw)
       
    47         win.add(label_size, halign='center', margin=Borders(t=8))
       
    48 
    44     def on_button_align_click(self, ev):
    49     def on_button_align_click(self, ev):
    45         align_type = ev.originator.label.split(':', 1)[0]
    50         align_type = ev.originator.label.split(':', 1)[0]
    46         align = self.win.hints[align_type]
    51         align = self.win.hints[align_type]
    47         align.select_next()
    52         align.select_next()
    48         ev.originator.label = '%s: %s' % (align_type, align.selected)
    53         ev.originator.label = '%s: %s' % (align_type, align.selected)
    49         self.top.emit('resize')
    54         self.top.emit('resize')
    50         return True
    55         return True
    51 
    56 
    52     def on_label_margin_draw(self, ev):
    57     def on_label_margin_draw(self, ev):
    53         ev.originator.label = str(self.win.hints['margin'])
    58         ev.originator.label = str(self.win.hints['margin'])
       
    59 
       
    60     def on_label_size_draw(self, ev):
       
    61         ev.originator.label = str(self.win.sizereq)
    54 
    62 
    55     def on_top_keypress(self, ev):
    63     def on_top_keypress(self, ev):
    56         if ev.keyname == 'escape':
    64         if ev.keyname == 'escape':
    57             self.terminate()
    65             self.terminate()
    58             return True
    66             return True