def _create_component(self): text_field = TextField(position=[25, 100], width=200) text = "This a test with a text field\nthat has more text than\n" text += "can fit in it." text_field2 = TextField( position=[25, 200], width=200, height=50, multiline=True, text=text, font="Courier New 14", ) text_field3 = TextField( position=[250, 50], height=300, width=200, multiline=True, font="Courier New 14", ) container = Container(bounds=size, bgcolor="grey") container.add(text_field, text_field2, text_field3) return container
def _create_component(self): stack = VStackedContainer( position=[0, 0], halign="center", valign="center", # border_visible=True, fit_components="hv", auto_size=True, stack_order="top_to_bottom", bgcolor="red", ) strings = [ "apple", "banana", "cherry", "durian", "eggfruit", "fig", "grape", "honeydew", ] for i, s in enumerate(strings): label = TextField( text=s, resizable="", bounds=[100 + i * 10, 20], bgcolor="red", # border_visible=True, text_offset=1, ) number = TextField( text=str(i + 1), resizable="", bgcolor="blue", # border_visible=True, text_offset=1, can_edit=False, bounds=[20, 20], ) row = HStackedContainer( fit_components="hv", auto_size=True, resizable="", valign="top", border_visible=True, ) row.add(number) row.add(label) stack.add(row) container = Container(position=[20, 20], bounds=size) container.add(stack) container2 = Container(bounds=size) container2.add(container) return container2
def _add_column(self, index): for row in self.cells: tfield = TextField(position=[0, 0], width=self.cell_width, height=self.cell_height, multiline=False) self.add(tfield) row.insert(index, tfield) self.bounds[0] = self.bounds[0] + self.cell_padding + self.cell_width
def _create_window(self): stack = VStackedContainer( position=[0, 0], halign='center', valign='center', #border_visible=True, fit_components='hv', auto_size=True, stack_order='top_to_bottom', bgcolor='red') strings = [ "apple", "banana", "cherry", "durian", "eggfruit", "fig", "grape", "honeydew" ] for i, s in enumerate(strings): label = TextField( text=s, resizable='', bounds=[100 + i * 10, 20], bgcolor='red', #border_visible=True, text_offset=1) number = TextField( text=str(i + 1), resizable='', bgcolor='blue', #border_visible=True, text_offset=1, can_edit=False, bounds=[20, 20]) row = HStackedContainer(fit_components='hv', auto_size=True, resizable='', valign='top', border_visible=True) row.add(number) row.add(label) stack.add(row) container = Container(position=[20, 20], bounds=size) container.add(stack) container2 = Container(bounds=size) container2.add(container) return Window(self, -1, component=container2)
def _add_row(self, index): row = [] for i in range(self.columns): tfield = TextField(position=[0, 0], width=self.cell_width, height=self.cell_height, multiline=False) self.add(tfield) row.append(tfield) self.cells.insert(index, row) self.bounds[1] = self.bounds[1] + self.cell_padding + self.cell_height