def new_game(self): self.time_count = 0 self.mine_table = gui.Table(900, 450) self.mine_matrix = self.build_mine_matrix(30, 15, 60) self.mine_table.from_2d_matrix(self.mine_matrix, False) self.main_container.append("mine_table", self.mine_table) self.check_if_win()
def initStats(self, robot): statsBox = self.sectionBox() motorDataBox = sea.vBoxWith(gui.Label("Motor Data")) self.motorDataTable = gui.Table() motorNumRow = gui.TableRow(gui.TableItem("Motor Number:")) motorAmpRow = gui.TableRow(gui.TableItem("Amp Draw:")) motorTempRow = gui.TableRow(gui.TableItem("Temp:")) motorMaxAmpRow = gui.TableRow(gui.TableItem("Max Amp Draw:")) motorMaxTempRow = gui.TableRow(gui.TableItem("Max Temp:")) self.motorDataTable.append(motorNumRow) self.motorDataDict["ampRow"] = self.motorDataTable.append(motorAmpRow) self.motorDataDict["tempRow"] = self.motorDataTable.append( motorTempRow) self.motorDataDict["maxAmpRow"] = self.motorDataTable.append( motorMaxAmpRow) self.motorDataDict["maxTempRow"] = self.motorDataTable.append( motorMaxTempRow) for motorNum in range(6): motorNumRow.append(gui.TableItem(str(motorNum + 1))) self.motorDataDict["amp"].append( motorAmpRow.append(gui.TableItem(""))) self.motorDataDict["temp"].append( motorTempRow.append(gui.TableItem(""))) self.motorDataDict["maxAmp"].append( motorMaxAmpRow.append(gui.TableItem(""))) self.motorDataDict["maxTemp"].append( motorMaxTempRow.append(gui.TableItem(""))) motorDataBox.append(self.motorDataTable) statsBox.append(motorDataBox) return statsBox
def make_gui_elements(self): # content and behaviour #logo: self.logo_image = gui.Image('/res/logo.png') self.logo_image.attributes[ "onclick"] = "document.location='https://www.youtube.com/watch?v=t-fcrn1Edik'" #playback controls self.playback = Namespace() self.playback.playing = gui.Label( "Now playing: None") # (TODO): update this self.playback.party = gui.Button(icons.PARTY) self.playback.party.attributes[ "onclick"] = "document.body.classList.toggle('dancing');" self.playback.party.attributes[ "title"] = "ENABLE PARTY MODE" # hover text self.playback.previous = gui.Button(icons.PREV) self.playback.previous.set_on_click_listener(self.playback_previous) self.playback.play = gui.Button(icons.PLAY) self.playback.play.set_on_click_listener(self.playback_play) self.playback.next = gui.Button(icons.NEXT) self.playback.next.set_on_click_listener(self.playback_next) self.playback.volume_label = gui.Label("Volume:") self.playback.volume_slider = gui.Slider(100, 0, 100, 1) self.playback.volume_slider.set_oninput_listener(self.change_volume) self.playback.seek_slider = gui.Slider(0, 0, 100, 1) self.playback.seek_slider.set_oninput_listener(self.change_seek) self.playback.timestamp = gui.Label("--:-- - --:--") #playlist self.playlist = Namespace() self.playlist.table = gui.Table() self.playlist.table.append_from_list( [['#', 'Name', "length", "", "", "", ""]], fill_title=True) self.playlist.looping = gui.CheckBoxLabel( "<i><small>loop playlist</small></i>") self.playlist.looping.set_on_click_listener( self.on_playlist_set_looping) self.playlist.shuffle = gui.Button("SHUFFLE") self.playlist.shuffle.set_on_click_listener( self.on_playlist_clear_shuffle) self.playlist.clear = gui.Button("CLEAR") self.playlist.clear.set_on_click_listener(self.on_playlist_clear_click) #input self.input = Namespace() self.input.add_song = gui.Label("Add song:") self.input.field = gui.TextInput(single_line=True) self.input.field.set_on_enter_listener(self.input_submit) self.input.submit = gui.Button("Submit!") self.input.submit.set_on_click_listener(self.input_submit)
def new_game(self, widget): self.time_count = 0 self.mine_table = gui.Table() #900, 450 self.mine_matrix = self.build_mine_matrix(30, 15, 60) self.mine_table.from_2d_matrix(self.mine_matrix, False) self.main_container.append(self.mine_table, key="mine_table") self.check_if_win() self.set_root_widget(self.main_container)
def new_game(self, widget): self.time_count = 0 self.mine_table = gui.Table(margin='0px auto') #900, 450 self.mine_matrix = self.build_mine_matrix(8, 8, 5) self.mine_table.empty() self.mine_table.append_from_list(self.mine_matrix, False) self.main_container.append(self.mine_table, key="mine_table") self.check_if_win() self.set_root_widget(self.main_container)
def on_button_pressed(self): # Connect to the sqlite database using DB.py db = DB(filename="/home/pybokeh/Dropbox/data_sets/nba", dbtype="sqlite") sql = """ select * from player_game_stats where team_name like '{{ name }}';""" # Get the text the user entered into the textinput widget token = self.txt.get_text() # To prevent sql injection attacks, parameterize the sql string parameter = '%' + token + '%' params = [ {"name": parameter} ] # Execute the query and store the results into a pandas dataframe df = db.query(sql, data=params) # Get the column names of the query result and the query row_data column_names = df.columns row_data = df.values # Create the table widget with the specified dimensions self.table = gui.Table(1200, 800) # Generate the table row containing the table column names row = gui.TableRow() for column in column_names: item = gui.TableTitle() # TableTitle refers to the column header/names item.append(str(id(item)), str(column)) row.append(str(id(item)), item) # Now add the row to the table self.table.append(str(id(row)), row) # Generate rows that will contain the table data for _row in row_data: row = gui.TableRow() for row_item in _row: item = gui.TableItem() # TableItem refers to the table data item.append(str(id(item)), str(row_item)) row.append(str(id(item)), item) self.table.append(str(id(row)), row) # Now render / add the bottom container to the master container self.masterContainer.append('2', self.bottomContainer) # Now add the table widget to the bottom container self.bottomContainer.append('1', self.table)
def explosion(self, cell): print("explosion") self.mine_table = gui.Table() self.main_container.append(self.mine_table, key="mine_table") for x in range(0, len(self.mine_matrix[0])): for y in range(0, len(self.mine_matrix)): self.mine_matrix[y][x].style['background-color'] = 'red' self.mine_matrix[y][x].check_mine(None, False) self.mine_table.from_2d_matrix(self.mine_matrix, False)
def new_game(self, widget): self.time_count = 0 self.mine_table = gui.Table(margin='0px auto') # 900, 450 self.mine_matrix = self.build_mine_matrix(8, 8, 5) self.mine_table.empty() for x in range(0, len(self.mine_matrix[0])): row = gui.TableRow() for y in range(0, len(self.mine_matrix)): row.append(self.mine_matrix[y][x]) self.mine_matrix[y][x].onclick.do(self.mine_matrix[y][x].check_mine) self.mine_table.append(row) # self.mine_table.append_from_list(self.mine_matrix, False) self.main_container.append(self.mine_table, key="mine_table") self.check_if_win() self.set_root_widget(self.main_container)
def explosion(self, cell): print("explosion") self.mine_table = gui.Table(margin='0px auto') self.main_container.append(self.mine_table, key="mine_table") for x in range(0, len(self.mine_matrix[0])): for y in range(0, len(self.mine_matrix)): self.mine_matrix[y][x].style['background-color'] = 'red' self.mine_matrix[y][x].check_mine(None, False) self.mine_table.empty() # self.mine_table.append_from_list(self.mine_matrix, False) for x in range(0, len(self.mine_matrix[0])): row = gui.TableRow() for y in range(0, len(self.mine_matrix)): row.append(self.mine_matrix[y][x]) self.mine_matrix[y][x].onclick.do(self.mine_matrix[y][x].check_mine) self.mine_table.append(row)
def __init__(self, app: 'LessonReplaceBotApp'): self.app = app super().__init__(width=ALL, height='92%') style = { 'justify-content': 'flex-start', 'align-items': 'stretch', 'background-color': 'transparent', } vbox = gui.VBox(width=ALL, height=ALL) vbox.style.update(style) vbox.style.update({ 'background-image': "url('https://sch1210sz.mskobr.ru/attach_files/logo/IMG_7037.png')", 'background-repeat': 'no-repeat', 'background-position': 'right top', }) date_box = gui.HBox() date_box.style.update(style) now_str = datetime.datetime.now().strftime('%Y-%m-%d') self.date_picker = gui.Date(now_str, width=WIDTH, height=HEIGHT, margin=MARGIN) self.date_picker.onchange.do(lambda w, e: self.refresh_table()) date_box.append(gui.Label("Дата:", height=HEIGHT, margin=MARGIN)) date_box.append(self.date_picker) vbox.append(date_box) vbox.append(gui.Label("Новая замена:", height=HEIGHT, margin=MARGIN)) repl_box = gui.HBox() repl_box.style.update(style) repl_box.append(gui.Label("Класс:", height=HEIGHT, margin=MARGIN)) self.dd_class_no = gui.DropDown.new_from_list( [str(i) for i in range(1, 12)], height=HEIGHT, margin=MARGIN, width=MIN_WIDTH) repl_box.append(self.dd_class_no) rus_a = ord('А') self.dd_class_letter = gui.DropDown.new_from_list( [chr(i) for i in range(rus_a, rus_a + 32)], height=HEIGHT, margin=MARGIN, width=MIN_WIDTH) repl_box.append(self.dd_class_letter) repl_box.append(gui.Label("Урок:", height=HEIGHT, margin=MARGIN)) self.dd_lesson_no = gui.DropDown.new_from_list( [str(i) for i in range(1, 11)], height=HEIGHT, margin=MARGIN, width=MIN_WIDTH) repl_box.append(self.dd_lesson_no) repl_box.append(gui.Label("Предмет:", height=HEIGHT, margin=MARGIN)) self.dd_lesson = gui.DropDown(height=HEIGHT, margin=MARGIN, width=WIDTH) repl_box.append(self.dd_lesson) self.refresh_lesson_dd() repl_box.append(gui.Label("Учитель:", height=HEIGHT, margin=MARGIN)) self.dd_teacher = gui.DropDown(height=HEIGHT, margin=MARGIN, width=WIDTH) repl_box.append(self.dd_teacher) self.refresh_teacher_dd() self.add_btn = gui.Button("Добавить", height=HEIGHT, width=WIDTH, margin=MARGIN) self.add_btn.onclick.do(self.on_add_btn_click) repl_box.append(self.add_btn) vbox.append(repl_box) vbox.append( gui.Label("Запланированные замены:", height=HEIGHT, margin=MARGIN)) self.table = gui.Table(width='95%', margin=MARGIN) view_port = gui.Container(width=ALL, height=ALL, style={"overflow-y": "scroll"}) view_port.append(self.table) vbox.append(view_port) self.refresh_table() self.append(vbox)
def on_dropdown_change(self, widget, value): # If we had a previous client, disconnect it if self.dyn_rec_client is not None: self.dyn_rec_client.close() # Get new client self.dyn_rec_client = drc.Client(value, timeout=10.0) # Get a configuration which ensures we'll have the description too curr_conf = self.dyn_rec_client.get_configuration() self.gui_set_funcs_for_param = {} params_list = self.dyn_rec_client.group_description['parameters'] if params_list is not None: table = gui.Table() row = gui.TableRow() item = gui.TableTitle() item.add_child(str(id(item)), 'Param name') row.add_child(str(id(item)), item) item = gui.TableTitle() item.add_child(str(id(item)), 'Min') row.add_child(str(id(item)), item) item = gui.TableTitle() item.add_child(str(id(item)), 'Edit') row.add_child(str(id(item)), item) item = gui.TableTitle() item.add_child(str(id(item)), 'Max') row.add_child(str(id(item)), item) item = gui.TableTitle() item.add_child(str(id(item)), 'Edit2') row.add_child(str(id(item)), item) table.add_child(str(id(row)), row) for idx, param in enumerate(params_list): if param['edit_method'] != '': # Enum param_name = param['name'] # WTF, really? the full enum dict is actually a string? enum_dict_as_str = param['edit_method'] enum_dict = literal_eval(enum_dict_as_str) description = enum_dict['enum_description'] current_value = curr_conf[param_name] enums = enum_dict['enum'] # there must be at least one enum enum_type = enums[0]['type'] # Create dynamically a method to be called method_name, cb_method = self.add_cb_to_class_by_param_name_and_type( param_name, 'enum', enum_type) enum_wid, set_funcs = self.create_enum_row( param_name, description, current_value, cb_method, enums) self.gui_set_funcs_for_param[param_name] = set_funcs table.add_child(idx, enum_wid) elif param['type'] == 'int' or param['type'] == 'double': param_name = param['name'] range_min = param['min'] range_max = param['max'] description = param['description'] current_value = curr_conf[param_name] if param['type'] == 'int': step = (range_max - range_min) / 100 elif param['type'] == 'double': step = (range_max - range_min) / 100.0 # Create dynamically a method to be called method_name, cb_method = self.add_cb_to_class_by_param_name_and_type( param_name, 'digit') num_wid, set_funcs = self.create_num_row( param_name, description, range_min, range_max, current_value, cb_method, step) self.gui_set_funcs_for_param[param_name] = set_funcs table.add_child(idx, num_wid) elif param['type'] == 'str': param_name = param['name'] current_value = curr_conf[param_name] description = param['description'] # Create dynamically a method to be called method_name, cb_method = self.add_cb_to_class_by_param_name_and_type( param_name, 'string') str_wid, set_funcs = self.create_str_row( param_name, description, current_value, cb_method) self.gui_set_funcs_for_param[param_name] = set_funcs table.add_child(idx, str_wid) elif param['type'] == 'bool': param_name = param['name'] current_value = curr_conf[param_name] description = param['description'] # Create dynamically a method to be called method_name, cb_method = self.add_cb_to_class_by_param_name_and_type( param_name, 'bool') bool_wid, set_funcs = self.create_bool_row( param_name, description, current_value, cb_method) self.gui_set_funcs_for_param[param_name] = set_funcs table.add_child(idx, bool_wid) self.wid.add_child(2, table) # This must be done later on! HACK! (append sets a margin) # This makes the table not stick left, but float in the middle table.style['margin'] = '10px auto' # Once the GUI is setup, setup the callback for new configs self.dyn_rec_client.set_config_callback(self.dyn_rec_conf_callback)
def main(self, args): self.debug = args["debug"] utils.debug_msg(self, "start main") self.api_url = "http://127.0.0.1:5000/v1/" self.api_data = {} self.api_last_updated = 1 self.api_update_interval = 5 self.api_read() self.settings_up = False self.edit_keg_up = False self.delete_keg_up = False self.co2_list = [] # root object self.container = gui.VBox(width=480) self.container.style['margin'] = 'auto' self.container.style['text-align'] = 'center' # header self.header = gui.Table(width=480) self.header.style['margin'] = 'auto' self.header.style['text-align'] = 'center' self.header.style['padding'] = '2em' # keg table self.keg_table = gui.Table(width=480) self.keg_table.style['margin'] = 'auto' self.keg_table.style['text-align'] = 'center' self.keg_table.style['padding'] = '2em' # first row first_row = gui.TableRow(height=60) # temperature t = utils.as_degF(self.api_data.get('temp', 0)) self.temp = gui.Label("%s<br />CO2:%s%%" % (t, '???')) self.temp.style['padding-bottom'] = '1em' self.temp.style['white-space'] = 'pre' table_item = gui.TableItem(width=100, height=30) table_item.append(self.temp) first_row.append(table_item) # title self.title = gui.Label("HOPLITE") self.title.style['font-size'] = '2em' self.title.style['padding-bottom'] = '0.5em' table_item = gui.TableItem(width=240, height=30) table_item.append(self.title) first_row.append(table_item) # settings button self.settings_button = gui.Image('/static:settings_16.png', width=16) self.settings_button.set_on_click_listener(self.show_settings) self.settings_button.style['padding-bottom'] = '1.6em' table_item = gui.TableItem(width=100, height=30) table_item.append(self.settings_button) first_row.append(table_item) self.header.append(first_row) self.container.append(self.header) self.keg_table = self.build_keg_table() self.container.append(self.keg_table, 'keg_table') try: co2 = self.co2_list[0] #TODO: Handle multiple CO2 sources except IndexError: co2 = "???" self.temp.set_text("%s\nCO2:%s%%" % (t, co2)) utils.debug_msg(self, "end main") # return of the root widget return self.container
def build_keg_table(self): utils.debug_msg(self, "start") new_table = gui.Table(width=480) new_table.style['margin'] = 'auto' new_table.style['text-align'] = 'center' new_table.style['padding'] = '2em' w_mode = self.api_data.get('weight_mode', 'as_kg_gross') # iterate through HX sensors for index, hx_conf in enumerate(self.api_data['hx_list']): # keg information for channel in ['A', 'B']: try: keg_name = hx_conf['channels'][channel].get('name', None) except KeyError: keg_name = None try: if hx_conf['channels'][channel]['co2'] == True: local_w = hx_conf['channels'][channel]['weight'] local_max = hx_conf['channels'][channel][ 'volume'] * 1000 local_tare = hx_conf['channels'][channel]['tare'] * 1000 local_net_w = max((local_w - local_tare), 0) local_pct = local_net_w / float(local_max) self.co2_list.append(int(local_pct * 100)) continue except KeyError: pass if keg_name != None: utils.debug_msg(self, hx_conf['channels'][channel]) keg_label = gui.Label(keg_name, width=100, height=30) keg_bar = gui.Svg(width=240, height=30) keg_w = hx_conf['channels'][channel]['weight'] keg_cap = hx_conf['channels'][channel]['volume'] keg_tare = hx_conf['channels'][channel]['tare'] keg_fill_pct = utils.get_keg_fill_percent( keg_w, keg_cap, keg_tare) keg_bar_rect = gui.SvgRectangle(0, 0, 240 * keg_fill_pct, 30) keg_bar_rect.style['fill'] = utils.fill_bar_color( keg_fill_pct) keg_bar_outline = gui.SvgRectangle(0, 0, 240, 30) keg_bar_outline.style['fill'] = 'rgb(0,0,0)' keg_bar_outline.style['fill-opacity'] = '0' keg_bar.append(keg_bar_rect) keg_bar.append(keg_bar_outline) keg_weight = gui.Label(utils.format_weight( keg_w, w_mode, tare=(keg_tare * 1000), cap=(keg_cap * 1000)), width=100, height=30) table_row = gui.TableRow(height=30) for item in [keg_label, keg_bar, keg_weight]: table_item = gui.TableItem() table_item.append(item) table_row.append(table_item) new_table.append(table_row) utils.debug_msg(self, "end") return new_table
def main(self): verticalContainer = gui.Widget(640, 900, gui.Widget.LAYOUT_VERTICAL, 10) horizontalContainer = gui.Widget(620, 620, gui.Widget.LAYOUT_HORIZONTAL, 10) subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10) self.img = gui.Image(100, 100, '/res/logo.png') self.img.set_on_click_listener(self, 'on_img_clicked') self.table = gui.Table(300, 200) self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'], ['101', 'Danny', 'Young'], ['102', 'Christine', 'Holand'], ['103', 'Lars', 'Gordon'], ['104', 'Roberto', 'Robitaille'], ['105', 'Maria', 'Papadopoulos']]) # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL, 10) self.count = 0 self.counter = gui.Label(200, 30, '') self.lbl = gui.Label(200, 30, 'This is a LABEL!') self.bt = gui.Button(200, 30, 'Press me!') # setting the listener for the onclick event of the button self.bt.set_on_click_listener(self, 'on_button_pressed') self.txt = gui.TextInput(200, 30) self.txt.set_text('This is a TEXTAREA') self.txt.set_on_change_listener(self, 'on_text_area_change') self.spin = gui.SpinBox(200, 30, 100) self.spin.set_on_change_listener(self, 'on_spin_change') self.check = gui.CheckBoxLabel(200, 30, 'Label checkbox', True) self.check.set_on_change_listener(self, 'on_check_change') self.btInputDiag = gui.Button(200, 30, 'Open InputDialog') self.btInputDiag.set_on_click_listener(self, 'open_input_dialog') self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog') self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog') self.btUploadFile = gui.FileUploader(200, 30, './') self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success') self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed') self.listView = gui.ListView(300, 120) self.listView.set_on_selection_listener(self, "list_view_on_selected") li0 = gui.ListItem(279, 20, 'Danny Young') li1 = gui.ListItem(279, 20, 'Christine Holand') li2 = gui.ListItem(279, 20, 'Lars Gordon') li3 = gui.ListItem(279, 20, 'Roberto Robitaille') self.listView.append('0', li0) self.listView.append('1', li1) self.listView.append('2', li2) self.listView.append('3', li3) self.link = gui.Link(200, 20, "http://localhost:8081", "A link to here") self.dropDown = gui.DropDown(200, 20) c0 = gui.DropDownItem(200, 20, 'DropDownItem 0') c1 = gui.DropDownItem(200, 20, 'DropDownItem 1') self.dropDown.append('0', c0) self.dropDown.append('1', c1) self.dropDown.set_on_change_listener(self, 'drop_down_changed') self.dropDown.set_value('DropDownItem 0') self.slider = gui.Slider(200, 20, 10, 0, 100, 5) self.slider.set_on_change_listener(self, 'slider_changed') self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00') self.colorPicker.set_on_change_listener(self, 'color_picker_changed') self.date = gui.Date(200, 20, '2015-04-13') self.date.set_on_change_listener(self, 'date_changed') self.video = gui.VideoPlayer( 480, 270, 'http://www.w3schools.com/tags/movie.mp4', 'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg' ) # appending a widget to another, the first argument is a string key subContainerRight.append('0', self.counter) subContainerRight.append('1', self.lbl) subContainerRight.append('2', self.bt) subContainerRight.append('3', self.txt) subContainerRight.append('4', self.spin) subContainerRight.append('checkbox', self.check) subContainerRight.append('5', self.btInputDiag) subContainerRight.append('5_', self.btFileDiag) subContainerRight.append( '5__', gui.FileDownloader(200, 30, 'download test', '../remi/res/logo.png')) subContainerRight.append('5___', self.btUploadFile) subContainerRight.append('6', self.dropDown) subContainerRight.append('7', self.slider) subContainerRight.append('8', self.colorPicker) subContainerRight.append('9', self.date) self.subContainerRight = subContainerRight subContainerLeft.append('0', self.img) subContainerLeft.append('1', self.table) subContainerLeft.append('2', self.listView) subContainerLeft.append('3', self.link) subContainerLeft.append('4', self.video) horizontalContainer.append('0', subContainerLeft) horizontalContainer.append('1', subContainerRight) menu = gui.Menu(620, 30) m1 = gui.MenuItem(100, 30, 'File') m2 = gui.MenuItem(100, 30, 'View') m2.set_on_click_listener(self, 'menu_view_clicked') m11 = gui.MenuItem(100, 30, 'Save') m12 = gui.MenuItem(100, 30, 'Open') m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem(100, 30, 'Save') m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem(100, 30, 'Save as') m112.set_on_click_listener(self, 'menu_saveas_clicked') m3 = gui.MenuItem(100, 30, 'Dialog') m3.set_on_click_listener(self, 'menu_dialog_clicked') menu.append('1', m1) menu.append('2', m2) menu.append('3', m3) m1.append('11', m11) m1.append('12', m12) m11.append('111', m111) m11.append('112', m112) menubar = gui.MenuBar(620, 30) menubar.append('1', menu) verticalContainer.append('0', menubar) verticalContainer.append('1', horizontalContainer) # kick of regular display of counter self.display_counter() # returning the root widget return verticalContainer
def main(self): # root widget # vertical_container = gui.Widget(width='100%', height='100%') # vertical_container.style['background-color'] = bgcolor # vertical_container.style['display'] = display # vertical_container.style['overflow'] = overflow horizontal_container = gui.Widget(width='100%', height='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL) horizontal_container.style['background-color'] = bgcolor horizontal_container.style['display'] = display horizontal_container.style['overflow'] = 'scroll' horizontal_container.style['text-align'] = 'center' sub_container_left = gui.Widget(width='50%', layout_orientation=gui.Widget.LAYOUT_VERTICAL) sub_container_left.style['background-color'] = bgcolor sub_container_left.style['display'] = display sub_container_left.style['overflow'] = overflow sub_container_left.style['text-align'] = 'center' sub_container_right = gui.Widget(width='50%', layout_orientation=gui.Widget.LAYOUT_VERTICAL) sub_container_right.style['background-color'] = bgcolor sub_container_right.style['display'] = display sub_container_right.style['overflow'] = overflow sub_container_right.style['text-align'] = 'center' vbox1 = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px') vbox1.style['background-color'] = bgcolor open_file = gui.Button('Open File', width='auto', height=30, margin='10px') open_file.set_on_click_listener(self, 'open_file_pressed') open_file.attributes['title'] = 'Clik here to open a .CSV file with your data' # open_file.style['font-size'] = 'large' open_clipboard = gui.Button('From Clipboard', widht='auto', height=30, margin='10px') open_clipboard.set_on_click_listener(self, 'open_clipboard_pressed') open_clipboard.attributes['title'] = 'Clik here to Paste data from the Clipboard eg: excel, html table, etc...' # open_clipboard.style['font-size'] = 'large' self.data_table = gui.Table(width='100%', height='100%', margin='10px') self.data_table.style['overflow'] = overflow # self.data_table.style['display'] = display vbox1.append(open_file) vbox1.append(open_clipboard) vbox2 = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px') vbox2.style['background-color'] = bgcolor charts = ["Cusum", "Ewma", "Sbar", "Rbar", "T-Square Single", "T-Square", "MEWMA", "C Chart", "NP Chart", "P Chart", "U Chart", "Moving Range", "I-MR-R", "I-MR-S"] self.dropdown = gui.DropDown.new_from_list(charts, width='auto', height=30, margin='10px') self.dropdown.attributes['title'] = 'Choose the right control for the that you have' # self.dropdown.style['font-size'] = 'large' plot_chart = gui.Button('Plot Chart', width='auto', height=30, margin='10px') plot_chart.set_on_click_listener(self, 'plot_chart_pressed') # plot_chart.style['font-size'] = 'large' save_chart = gui.Button('Save Chart', width='auto', height=30, margin='10px') save_chart.set_on_click_listener(self, 'save_chart_pressed') # save_chart.style['font-size'] = 'large' self.mpl = MatplotImage(width='100%', height='auto') self.mpl.style['margin'] = '10px' vbox2.append(self.dropdown) vbox2.append(plot_chart) vbox2.append(save_chart) self.status_txt = gui.Label('', width='100%', height=20, margin='10px') sub_container_left.append(vbox1) sub_container_left.append(self.status_txt) sub_container_left.append(self.data_table) sub_container_right.append(vbox2) sub_container_right.append(self.mpl) horizontal_container.append(sub_container_left) horizontal_container.append(sub_container_right) # vertical_container.append(horizontal_container) return horizontal_container
def main(self): self.shmem_read(5) self.KegLines = list() self.settings_up = False # root object self.container = gui.Table(width=480) self.container.style['margin'] = 'auto' self.container.style['text-align'] = 'center' self.container.style['padding'] = '2em' # first row first_row = gui.TableRow(height=60) # temperature t = self.h.as_degF(self.ShData['data'].get('temp', 0)) co2 = self.ShData['data'].get('co2', '???') self.temp = gui.Label("%s<br />CO2:%s%%" % (t, co2)) self.temp.style['padding-bottom'] = '1em' table_item = gui.TableItem() table_item.append(self.temp) first_row.append(table_item) # title self.title = gui.Label("HOPLITE") self.title.style['font-size'] = '2em' self.title.style['padding-bottom'] = '0.5em' table_item = gui.TableItem() table_item.append(self.title) first_row.append(table_item) # settings button self.settings_button = gui.Image('/res/settings_16.png', width=16) self.settings_button.set_on_click_listener(self.show_settings_menu) self.settings_button.style['padding-bottom'] = '1.6em' table_item = gui.TableItem() table_item.append(self.settings_button) first_row.append(table_item) self.container.append(first_row) w_mode = self.ShData['config'].get('weight_mode', 'as_kg_gross') # iterate through HX sensors for index, hx_conf in enumerate(self.ShData['config']['hx']): hx_weight = self.ShData['data']['weight'][index] self.KegLines.insert(index, list()) self.KegLines[index].insert(0, None) self.KegLines[index].insert(1, None) # keg information for subindex, channel in enumerate(['A', 'B']): try: keg_name = hx_conf['channels'][channel].get('name', None) except KeyError: keg_name = None if keg_name != None: keg_label = gui.Label(keg_name, width=100, height=30) keg_bar = gui.Svg(240, 30) keg_w = hx_weight[subindex] keg_cap = hx_conf['channels'][channel]['size'][0] keg_tare = hx_conf['channels'][channel]['size'][1] keg_fill_pct = self.get_keg_fill_percent( keg_w, keg_cap, keg_tare) keg_bar_rect = gui.SvgRectangle(0, 0, 240 * keg_fill_pct, 30) keg_bar_rect.style['fill'] = self.h.fill_bar_color( keg_fill_pct) keg_bar_outline = gui.SvgRectangle(0, 0, 240, 30) keg_bar_outline.style['fill'] = 'rgb(0,0,0)' keg_bar_outline.style['fill-opacity'] = '0' keg_bar.append(keg_bar_rect) keg_bar.append(keg_bar_outline) keg_weight = gui.Label(self.h.format_weight( keg_w, (keg_tare * 1000), mode=w_mode, cap=(keg_cap * 1000)), width=100, height=30) try: self.KegLines[index].insert( subindex, [keg_label, keg_bar_rect, keg_weight]) except KeyError: self.KegLines.insert( index, [keg_label, keg_bar_rect, keg_weight]) table_row = gui.TableRow(height=30) for item in [keg_label, keg_bar, keg_weight]: table_item = gui.TableItem() table_item.append(item) table_row.append(table_item) self.container.append(table_row) # return of the root widget return self.container
def test_init(self): widget = gui.Table() assertValidHTML(widget.repr())
def create_disc_hist_objects(self): retval = [] title = gui.Label('Discussion History', width="100%", margin='auto', style={ 'text-align': 'center', 'font-size': '20px', 'margin-top': '5px', 'margin-bottom': '5px' }) retval.append(title) ##create some plots of the prior discussion if (self.userProfile.date == 1): retval.append( gui.Label('No prior discussions yet', width="100%", style={ 'text-align': 'center', 'margin-top': '5px', 'margin-bottom': '5px' })) return retval #default if date is not one #should add in switching between discussions table = gui.Table(width="100%", height="200px", style={'background-color': 'light-blue'}) tableCells = [("Discussion Number", "Instructional Goal", "Achieved")] #pull in the all of the date-1 goal files. for i in range(1, self.userProfile.date): goalPath = findByDate(BASEPATH, self.userProfile.teacher, str(i), filetype='goal', classifier=self.userProfile.classifier) print(goalPath) goalData = readGoalFile(goalPath) #check the next transcript for if the goal is in the strengths strList = self.userProfile.data[i]['strengths'] if (goalData['goalID'] in strList): achievedMsg = "Yes" else: achievedMsg = "No" tableCells.append((str(i), goalData['GoalText'], achievedMsg)) #tableCells.append(("2", "Increase the number of explanations the students give", "No??")) table.append_from_list(tableCells, fill_title=True) #modify the inspect so that someone can click it # ti = table.children["1"].children["3"] # ti.set_text("") # tib = gui.Button("Click to Inspect") # ti.append(tib) # self.trackContainer = self.DEFAULT_VISIBLE_CONTAINER() # self.trackContainer.style['background-color'] = 'aqua' # self.trackContainer.style['padding'] = "5px" # if(self.date == 3): # self.trackContainer.append(self.create_track_content(self.date-2, "Argumentation", "ArgMove" ,"explanation")) # self.trackContainer.append(self.create_track_content(self.date-1, "Argumentation", "ArgMove" ,"explanation")) # tib.onclick.do(partial(self.track_container_clicked, "2")) # if(self.date==3): # ti2 = table.children["2"].children["3"] # ti2.set_text("") # tib2 = gui.Button("Click to Inspect") # ti2.append(tib2) # tib2.onclick.do(partial(self.track_container_clicked, "3")) # #for i in table.children: # # if(i != "0"): # # ti = table.children[i].children # # ti["3"].set_text("") # # # # ti["3"].append() retval.append(table) # retval.append(self.trackContainer) #make a plot of the prior discussion graphics = gui.GridBox(width="100%") grid = [list(range(3))] for i in range(len(grid)): for j in range(len(grid[i])): grid[i][j] = 'pos%s%s' % (i, j) argLabels = list(self.userProfile.getCurrentTranscript()['graphData'] ['argMoveCount'].keys()) argY = [] argY_labels = [] indices = np.arange(self.userProfile.date - 1, max(-1, self.userProfile.date - 6), -1) for x in indices: arr = np.array([ self.userProfile.data[x]['graphData']['argMoveCount'][k] for k in argLabels ]) arr = arr / sum(arr) argY.insert(0, arr) argY_labels.insert(0, "Discussion %d" % (x + 1)) argPlot = self.create_graph_object(argY, argLabels, argY_labels) graphics.append(argPlot, 'pos00') specLabels = list(self.userProfile.getCurrentTranscript()['graphData'] ['specifiCount'].keys()) specY = [] specY_labels = [] indices = np.arange(self.userProfile.date - 1, max(-1, self.userProfile.date - 6), -1) for x in indices: arr = np.array([ self.userProfile.data[x]['graphData']['specifiCount'][k] for k in specLabels ]) arr = arr / sum(arr) specY.insert(0, arr) specY_labels.insert(0, "Discussion %d" % (x + 1)) specPlot = self.create_graph_object(specY, specLabels, specY_labels) graphics.append(specPlot, 'pos01') colLabels = list(self.userProfile.getCurrentTranscript()['graphData'] ['collabCount'].keys()) colY = [] colY_labels = [] indices = np.arange(self.userProfile.date - 1, max(-1, self.userProfile.date - 6), -1) for x in indices: arr = np.array([ self.userProfile.data[x]['graphData']['collabCount'][k] for k in colLabels ]) arr = arr / sum(arr) colY.insert(0, arr) colY_labels.insert(0, "Discussion %d" % (x + 1)) colPlot = self.create_graph_object(colY, colLabels, colY_labels) graphics.append(colPlot, 'pos02') graphics.define_grid(grid) retval += [graphics] return retval
def create_track_content(self, discIDX, goalType, goalCat, goal): #how many students improved their number of warrants. print( "This function is for making the tables on tracking at student level" ) print("This function is currently unused") #loop through prior discussion students = {} for turn in self.data[discIDX - 1]['turnList']: if (turn['Student'] != 'teacher'): if (turn['Student'] not in students): students[turn['Student']] = [0, 0] if (goalType == "Argumentation"): for elem in turn['Argumentation']: if (elem[goalCat] == goal): students[turn['Student']][0] += 1 for turn in self.data[discIDX]['turnList']: if (turn['Student'] != 'teacher'): if (turn['Student'] not in students): students[turn['Student']] = [0, 0] if (goalType == "Argumentation"): for elem in turn['Argumentation']: if (elem[goalCat] == goal): students[turn['Student']][1] += 1 #create a table of how many students improved their score tableElems = [["Number Improved", "Number did not Improve"], [0, 0]] for k in students: if (students[k][0] < students[k][1]): students[k] = True tableElems[1][0] += 1 else: students[k] = False tableElems[1][1] += 1 tableElems[1][0] = str(tableElems[1][0]) tableElems[1][1] = str(tableElems[1][1]) table = gui.Table(width="25%", style={'background-color': 'light-blue'}) table.append_from_list(tableElems, fill_title=True) self.data[discIDX]['improvementDetail'] = students json.dump( self.data[discIDX], open(findByDate(BASEPATH, self.teacher, str(discIDX + 1), classifier=self.userProfile.classifier), 'w', encoding="utf-8")) #ask about what the teacher did lbl = gui.Label("What did you do to achieve this goal?", width="25%") improvement = gui.DropDown(width="50%") #init with default values improvement.append("Activity") improvement.append("Mini-Lesson") improvement.append("More discussions") #when they select improvement.onchange.do(partial(self.improvementDropdown, discIDX)) #checkBoxes = [] #checkBoxes.append(gui.CheckBoxLabel(label="Activity")) #checkBoxes.append(gui.CheckBoxLabel(label="Mini-Lesson")) #checkBoxes.append(gui.CheckBoxLabel(label="More Discussions")) #create a table of the students and what they were improved by self.studentDetail = gui.TableWidget(width="100%") if ('improvementAction' in self.data[discIDX]): improvement.select_by_value( self.data[discIDX]['improvementAction']) else: self.data[discIDX]['improvementAction'] = "None Set" self.fill_improvement_table(discIDX) #butt = gui.Button("refresh table") #butt.onclick.do(partial(self.update_improvement_table, discIDX)) cont = DEFAULT_HIDDEN_CONTAINER() cont.append([table, lbl, improvement, self.studentDetail]) cont.attributes['discID'] = str(discIDX + 1) return cont
def main(self): verticalContainer = gui.Widget(width=540) verticalContainer.style['display'] = 'block' verticalContainer.style['overflow'] = 'hidden' horizontalContainer = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px') horizontalContainer.style['display'] = 'block' horizontalContainer.style['overflow'] = 'auto' subContainerLeft = gui.Widget(width=320) subContainerLeft.style['display'] = 'block' subContainerLeft.style['overflow'] = 'auto' subContainerLeft.style['text-align'] = 'center' self.img = gui.Image('/res/logo.png', width=100, height=100, margin='10px') self.img.set_on_click_listener(self, 'on_img_clicked') self.table = gui.Table(width=300, height=200, margin='10px') self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'], ['101', 'Danny', 'Young'], ['102', 'Christine', 'Holand'], ['103', 'Lars', 'Gordon'], ['104', 'Roberto', 'Robitaille'], ['105', 'Maria', 'Papadopoulos']]) # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Widget() subContainerRight.style['width'] = '220px' subContainerRight.style['display'] = 'block' subContainerRight.style['overflow'] = 'auto' subContainerRight.style['text-align'] = 'center' self.count = 0 self.counter = gui.Label('', width=200, height=30, margin='10px') self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px') self.bt = gui.Button('Press me!', width=200, height=30, margin='10px') # setting the listener for the onclick event of the button self.bt.set_on_click_listener(self, 'on_button_pressed') self.txt = gui.TextInput(width=200, height=30, margin='10px') self.txt.set_text('This is a TEXTAREA') self.txt.set_on_change_listener(self, 'on_text_area_change') self.spin = gui.SpinBox(100, width=200, height=30, margin='10px') self.spin.set_on_change_listener(self, 'on_spin_change') self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px') self.check.set_on_change_listener(self, 'on_check_change') self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px') self.btInputDiag.set_on_click_listener(self, 'open_input_dialog') self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px') self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog') self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px') self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success') self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed') items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille') self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px') self.listView.set_on_selection_listener(self, "list_view_on_selected") self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px') self.dropDown = gui.DropDown(width=200, height=20, margin='10px') c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20) c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20) self.dropDown.append(c0) self.dropDown.append(c1) self.dropDown.set_on_change_listener(self, 'drop_down_changed') self.dropDown.set_value('DropDownItem 0') self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px') self.slider.set_on_change_listener(self, 'slider_changed') self.colorPicker = gui.ColorPicker('#ffbb00', width=200, height=20, margin='10px') self.colorPicker.set_on_change_listener(self, 'color_picker_changed') self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px') self.date.set_on_change_listener(self, 'date_changed') self.video = gui.VideoPlayer('http://www.w3schools.com/tags/movie.mp4', 'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg', width=300, height=270, margin='10px') # appending a widget to another, the first argument is a string key subContainerRight.append(self.counter) subContainerRight.append(self.lbl) subContainerRight.append(self.bt) subContainerRight.append(self.txt) subContainerRight.append(self.spin) subContainerRight.append(self.check) subContainerRight.append(self.btInputDiag) subContainerRight.append(self.btFileDiag) # use a defined key as we replace this widget later fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px') subContainerRight.append(fdownloader, key='file_downloader') subContainerRight.append(self.btUploadFile) subContainerRight.append(self.dropDown) subContainerRight.append(self.slider) subContainerRight.append(self.colorPicker) subContainerRight.append(self.date) self.subContainerRight = subContainerRight subContainerLeft.append(self.img) subContainerLeft.append(self.table) subContainerLeft.append(self.listView) subContainerLeft.append(self.link) subContainerLeft.append(self.video) horizontalContainer.append(subContainerLeft) horizontalContainer.append(subContainerRight) menu = gui.Menu(width='100%', height='30px') m1 = gui.MenuItem('File', width=100, height=30) m2 = gui.MenuItem('View', width=100, height=30) m2.set_on_click_listener(self, 'menu_view_clicked') m11 = gui.MenuItem('Save', width=100, height=30) m12 = gui.MenuItem('Open', width=100, height=30) m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem('Save', width=100, height=30) m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem('Save as', width=100, height=30) m112.set_on_click_listener(self, 'menu_saveas_clicked') m3 = gui.MenuItem('Dialog', width=100, height=30) m3.set_on_click_listener(self, 'menu_dialog_clicked') menu.append(m1) menu.append(m2) menu.append(m3) m1.append(m11) m1.append(m12) m11.append(m111) m11.append(m112) menubar = gui.MenuBar(width='100%', height='30px') menubar.append(menu) verticalContainer.append(menubar) verticalContainer.append(horizontalContainer) # kick of regular display of counter self.display_counter() # returning the root widget return verticalContainer
def main(self): verticalContainer = gui.Widget(640, 680, gui.Widget.LAYOUT_VERTICAL, 10) horizontalContainer = gui.Widget(620, 620, gui.Widget.LAYOUT_HORIZONTAL, 10) subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10) self.img = gui.Image(100, 100, './res/logo.png') self.table = gui.Table(300, 200) row = gui.TableRow() item = gui.TableTitle() item.append(str(id(item)), 'ID') row.append(str(id(item)), item) item = gui.TableTitle() item.append(str(id(item)), 'First Name') row.append(str(id(item)), item) item = gui.TableTitle() item.append(str(id(item)), 'Last Name') row.append(str(id(item)), item) self.table.append(str(id(row)), row) self.add_table_row(self.table, '101', 'Danny', 'Young') self.add_table_row(self.table, '102', 'Christine', 'Holand') self.add_table_row(self.table, '103', 'Lars', 'Gordon') self.add_table_row(self.table, '104', 'Roberto', 'Robitaille') self.add_table_row(self.table, '105', 'Maria', 'Papadopoulos') # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL, 10) self.lbl = gui.Label(200, 30, 'This is a LABEL!') self.bt = gui.Button(200, 30, 'Press me!') # setting the listener for the onclick event of the button self.bt.set_on_click_listener(self, 'on_button_pressed') self.txt = gui.TextInput(200, 30) self.txt.set_text('This is a TEXTAREA') self.txt.set_on_change_listener(self, 'on_text_area_change') self.spin = gui.SpinBox(200, 30, 100) self.spin.set_on_change_listener(self, 'on_spin_change') self.btInputDiag = gui.Button(200, 30, 'Open InputDialog') self.btInputDiag.set_on_click_listener(self, 'open_input_dialog') self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog') self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog') self.btUploadFile = gui.FileUploader(200, 30, './') self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success') self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed') self.listView = gui.ListView(300, 120) self.listView.set_on_selection_listener(self, "list_view_on_selected") li0 = gui.ListItem(279, 20, 'Danny Young') li1 = gui.ListItem(279, 20, 'Christine Holand') li2 = gui.ListItem(279, 20, 'Lars Gordon') li3 = gui.ListItem(279, 20, 'Roberto Robitaille') self.listView.append('0', li0) self.listView.append('1', li1) self.listView.append('2', li2) self.listView.append('3', li3) self.dropDown = gui.DropDown(200, 20) c0 = gui.DropDownItem(200, 20, 'DropDownItem 0') c1 = gui.DropDownItem(200, 20, 'DropDownItem 1') self.dropDown.append('0', c0) self.dropDown.append('1', c1) self.dropDown.set_on_change_listener(self, 'drop_down_changed') self.dropDown.set_value('DropDownItem 0') self.slider = gui.Slider(200, 20, 10, 0, 100, 5) self.slider.set_on_change_listener(self, 'slider_changed') self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00') self.colorPicker.set_on_change_listener(self, 'color_picker_changed') self.date = gui.Date(200, 20, '2015-04-13') self.date.set_on_change_listener(self, 'date_changed') # appending a widget to another, the first argument is a string key subContainerRight.append('1', self.lbl) subContainerRight.append('2', self.bt) subContainerRight.append('3', self.txt) subContainerRight.append('4', self.spin) subContainerRight.append('5', self.btInputDiag) subContainerRight.append('5_', self.btFileDiag) subContainerRight.append( '5__', gui.FileDownloader(200, 30, 'download test', '../remi/res/logo.png')) subContainerRight.append('5___', self.btUploadFile) subContainerRight.append('6', self.dropDown) subContainerRight.append('7', self.slider) subContainerRight.append('8', self.colorPicker) subContainerRight.append('9', self.date) self.subContainerRight = subContainerRight subContainerLeft.append('0', self.img) subContainerLeft.append('1', self.table) subContainerLeft.append('2', self.listView) horizontalContainer.append('0', subContainerLeft) horizontalContainer.append('1', subContainerRight) menu = gui.Menu(620, 30) m1 = gui.MenuItem(100, 30, 'File') m2 = gui.MenuItem(100, 30, 'View') m2.set_on_click_listener(self, 'menu_view_clicked') m11 = gui.MenuItem(100, 30, 'Save') m12 = gui.MenuItem(100, 30, 'Open') m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem(100, 30, 'Save') m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem(100, 30, 'Save as') m112.set_on_click_listener(self, 'menu_saveas_clicked') menu.append('1', m1) menu.append('2', m2) m1.append('11', m11) m1.append('12', m12) m11.append('111', m111) m11.append('112', m112) verticalContainer.append('0', menu) verticalContainer.append('1', horizontalContainer) # returning the root widget return verticalContainer