| 21 | super(MyApp, self).__init__(*args) |
| 22 | |
| 23 | def main(self): |
| 24 | |
| 25 | b1 = gui.Button('Show second tab', width=200, height=30) |
| 26 | |
| 27 | tb = gui.TabBox(width='80%') |
| 28 | tb.append(b1, 'First') |
| 29 | |
| 30 | b2 = gui.Button('Show third tab', width=200, height=30) |
| 31 | tb.add_tab(b2, 'Second', None) |
| 32 | |
| 33 | b3 = gui.Button('Show first tab', width=200, height=30) |
| 34 | tb.add_tab(b3, 'Third', None) |
| 35 | |
| 36 | b1.onclick.do(self.on_bt1_pressed, tb, b2) |
| 37 | b2.onclick.do(self.on_bt2_pressed, tb, 'Third') |
| 38 | b3.onclick.do(self.on_bt3_pressed, tb, 0) |
| 39 | |
| 40 | return tb |
| 41 | |
| 42 | def on_bt1_pressed(self, widget, tabbox, refWidgetTab): |
| 43 | tabbox.select_by_widget(refWidgetTab) |