def add_block_label(self, title, row, column, row_span = 1, column_span = 1, padx = 1, pady = 0, center=True): """Function that adds a new block label to the CUI grid Parameters ---------- title : str The title of the block label row : int The row value, from the top down column : int The column value from the top down row_span=1 : int The number of rows to span accross column_span=1 : int the number of columns to span accross padx=1 : int number of padding characters in the x direction pady=0 : int number of padding characters in the y direction center : bool flag to tell label to be centered or left-aligned. Returns ------- new_label : BlockLabel A reference to the created block label object. """ id = 'Widget{}'.format(len(self.widgets.keys())) new_label = widgets.BlockLabel(id, title, self.grid, row, column, row_span, column_span, padx, pady, center) self.widgets[id] = new_label return new_label
def add_block_label(self, title: str, row: int, column: int, row_span: int = 1, column_span: int = 1, padx: int = 1, pady: int = 0, center: bool = True) -> 'py_cui.widgets.BlockLabel': """Function that adds a new block label to the CUI grid Parameters ---------- title : str The title of the block label row : int The row value, from the top down column : int The column value from the top down row_span=1 : int The number of rows to span accross column_span=1 : int the number of columns to span accross padx=1 : int number of padding characters in the x direction pady=0 : int number of padding characters in the y direction center : bool flag to tell label to be centered or left-aligned. Returns ------- new_label : BlockLabel A reference to the created block label object. """ id = len(self.get_widgets().keys()) new_label = widgets.BlockLabel(id, title, self._grid, row, column, row_span, column_span, padx, pady, center, self._logger) self._widgets[id] = new_label self._logger.debug( f'Adding widget {title} w/ ID {id} of type {str(type(new_label))}') return new_label