How to use the asciimatics.widgets.Button function in asciimatics

To help you get started, we’ve selected a few asciimatics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cowboy8625 / WordRPG / gui / asciimatics / test_asciimatics.py View on Github external
("Item 3", 10),
			 ("Item 3", 11),
			 ("Item 3", 12),
			 ("Item 3", 13),
			 ("Item 3", 14),
			 ("Item 3", 15),
			 ("Item 3", 16),
			 ("Item 4", 17),
			 ("Item 5", 18), ],
			label="Dropdown", name="DD", on_change=self._on_change), 1)
		self.layout.add_widget(Divider(height=3), 1)

		layout2 = Layout([1, 1, 1])
		self.add_layout(layout2)
		layout2.add_widget(self._reset_button, 0)
		layout2.add_widget(Button("View Data", self._view), 1)
		layout2.add_widget(Button("Quit", self._quit), 2)

		self.fix()
github peterbrittain / asciimatics / tests / test_widgets.py View on Github external
name="Things",
                                       on_change=self._on_change), 1)
        layout.add_widget(CheckBox("Field 1",
                                   label="A very silly long name for fields:",
                                   name="CA",
                                   on_change=self._on_change), 1)
        layout.add_widget(
            CheckBox("Field 2", name="CB", on_change=self._on_change), 1)
        layout.add_widget(
            CheckBox("Field 3", name="CC", on_change=self._on_change), 1)
        layout.add_widget(Divider(height=3), 1)
        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(self._reset_button, 0)
        layout2.add_widget(Button("View Data", self._view), 1)
        layout2.add_widget(Button("Quit", self._quit), 2)
        self.fix()
github peterbrittain / asciimatics / tests / test_widgets.py View on Github external
def __init__(self, screen, init_values):
        super(TestFrame2, self).__init__(screen,
                                         screen.height,
                                         screen.width,
                                         data={"selected": "None"},
                                         title="Test Frame 2")
        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,
            init_values,
            name="contacts",
            on_change=self._on_pick,
            on_select=self._on_select)
        self._edit_button = Button("Edit", self._edit)
        self._delete_button = Button("Delete", self._delete)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider(line_char="#"))
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Add", self._add), 0)
        layout2.add_widget(self._edit_button, 1)
        layout2.add_widget(self._delete_button, 2)
        layout2.add_widget(Button("Quit", self._quit), 3)
        layout3 = Layout([100])
        self.add_layout(layout3)
        self._info_text = Text(label="Selected:", name="selected")
        self._info_text.disabled = True
        layout3.add_widget(self._info_text)
github cowboy8625 / WordRPG / gui / _backup / asciimatics / _template.py View on Github external
def _init_nav( self ):
		layout = Layout( [ 1, 1, 1, 1, 1 ] )	# columns that take up 30%, 10%, 10%, 10%, 30% of available width
		self.add_layout( layout )
		layout.add_widget( Button(	"Back", self._back ), 1 )
		layout.add_widget( VerticalDivider( ), 2 )
		layout.add_widget( Button(	"OK", self._accept ), 3 )
github peterbrittain / asciimatics / samples / contact_list.py View on Github external
on_load=self._reload_list,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="Contact List")
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,
            model.get_summary(),
            name="contacts",
            add_scroll_bar=True,
            on_change=self._on_pick,
            on_select=self._edit)
        self._edit_button = Button("Edit", self._edit)
        self._delete_button = Button("Delete", self._delete)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Add", self._add), 0)
        layout2.add_widget(self._edit_button, 1)
        layout2.add_widget(self._delete_button, 2)
        layout2.add_widget(Button("Quit", self._quit), 3)
        self.fix()
        self._on_pick()
github peterbrittain / asciimatics / asciimatics / widgets.py View on Github external
h = len(menu_items)
        if x + w >= screen.width:
            x -= w - 1
        if y + h >= screen.height:
            y -= h - 1

        # Construct the Frame
        super(PopupMenu, self).__init__(
            screen, h, w, x=x, y=y, has_border=False, is_modal=True)

        # Build the widget to display the time selection.
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)
        for item in menu_items:
            func = partial(self._destroy, item[1])
            layout.add_widget(Button(item[0], func, add_box=False), 0)
        self.fix()
github kayagoban / shadowlands / shadowlands / sl_frame.py View on Github external
def add_button(self, ok_fn, text, layout=[100], layout_index=0, add_divider=True):
        _layout = Layout(layout)
        self.add_layout(_layout)
        _layout.add_widget(Button(text, ok_fn), layout_index)
        if add_divider:
            _layout.add_widget(Divider(draw_line=False))
github peterbrittain / asciimatics / samples / experimental.py View on Github external
label="A Longer Selection:",
                                       name="Things",
                                       on_change=self._on_change), 1)
        layout.add_widget(CheckBox("Field 1",
                                   label="A very silly long name for fields:",
                                   name="CA",
                                   on_change=self._on_change), 1)
        layout.add_widget(
            CheckBox("Field 2", name="CB", on_change=self._on_change), 1)
        layout.add_widget(
            CheckBox("Field 3", name="CC", on_change=self._on_change), 1)
        layout.add_widget(Divider(height=3), 1)
        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(self._reset_button, 0)
        layout2.add_widget(Button("View Data", self._view), 1)
        layout2.add_widget(Button("Quit", self._quit), 2)
        self.fix()
github kayagoban / shadowlands / shadowlands / sl_frame.py View on Github external
def add_button_row(self, buttons, layout=[1, 1, 1, 1], add_divider=True):
        lyt = Layout(layout)
        self.add_layout(lyt)
        for b in buttons:
            lyt.add_widget(Button(b[0], b[1]), b[2])
        if add_divider:
            lyt.add_widget(Divider(draw_line=False))
github cowboy8625 / WordRPG / gui / _backup / asciimatics / _template.py View on Github external
def _init_nav( self ):
		layout = Layout( [ 1, 1, 1, 1, 1 ] )	# columns that take up 30%, 10%, 10%, 10%, 30% of available width
		self.add_layout( layout )
		layout.add_widget( Button(	"Back", self._back ), 1 )
		layout.add_widget( VerticalDivider( ), 2 )
		layout.add_widget( Button(	"OK", self._accept ), 3 )