(self)
| 32 | |
| 33 | class MyApp(App): |
| 34 | def main(self): |
| 35 | #creating a container GridBox type |
| 36 | main_container = gui.GridBox(width='100%', height='100%', style={'margin':'0px auto'}) |
| 37 | |
| 38 | label = gui.Label('This is a label') |
| 39 | label.style['background-color'] = 'lightgreen' |
| 40 | |
| 41 | button = gui.Button('Change layout', height='100%') |
| 42 | button.onclick.do(self.redefine_grid, main_container) |
| 43 | |
| 44 | text = gui.TextInput() |
| 45 | |
| 46 | main_container.set_from_asciiart(""" |
| 47 | |label |button | |
| 48 | |label |text | |
| 49 | |label |text | |
| 50 | |label |text | |
| 51 | |label |text | |
| 52 | """, 10, 10) |
| 53 | |
| 54 | main_container.append({'label':label, 'button':button, 'text':text}) |
| 55 | |
| 56 | # returning the root widget |
| 57 | return main_container |
| 58 | |
| 59 | def redefine_grid(self, emitter, container): |
| 60 | #redefining grid layout |
nothing calls this directly
no test coverage detected