Python urwid.Button() Examples
The following are 30
code examples of urwid.Button().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
urwid
, or try the search function
.
Example #1
Source File: spotify-restore.py From spotify-playlists-2-deezer with MIT License | 6 votes |
def playlistitems(title): global listitems bt_sv = urwid.Button("Save") urwid.connect_signal(bt_sv, 'click', showmenu) bt_ca = urwid.Button("Cancel") urwid.connect_signal(bt_ca, 'click', showmenu) bt_sa = urwid.Button("Select all") urwid.connect_signal(bt_sa, 'click', select_all) bt_da = urwid.Button("Deselect all") urwid.connect_signal(bt_da, 'click', deselect_all) footer = urwid.Columns([bt_sv, bt_sa, bt_da, bt_ca], 1) items = [] for item in playlist_names: items.append(urwid.CheckBox(item['name'], is_selected(item['id']), on_state_change=checkbox_callback, user_data=item['id'])) start.original_widget = TabFrame(urwid.ListBox(urwid.SimpleListWalker(items)), header=urwid.Text("Select Playlists"), footer=footer, focus_part='body') # main menu button handler
Example #2
Source File: chanBoardBuilder.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def buildFrame(self, board): '''returns the board widget''' threadButtonList = [] for threadNumber, threadInfo in self.threadsDict.items(): title = str(threadInfo[0]).replace('-', ' ') if self.uFilter: if re.search(self.uFilter.lower(), title.lower()): threadButton = urwid.Button(str(threadNumber), self.changeFrameThread) threadInfo = urwid.Text(self.info_text.format(str(threadInfo[1]),str(threadInfo[2]))) threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo] threadButtonList.append(urwid.LineBox(urwid.Pile(threadList))) else: threadButton = urwid.Button(str(threadNumber), self.changeFrameThread) threadInfo = urwid.Text(self.info_text.format(str(threadInfo[1]), str(threadInfo[2]))) threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo] threadButtonList.append(urwid.LineBox(urwid.Pile(threadList))) self.parsedItems = len(threadButtonList) catalogueButtons = urwid.GridFlow(threadButtonList, 30, 2, 2, 'center') listbox = urwid.ListBox(urwid.SimpleListWalker([catalogueButtons])) self.uvm.itemCount = len(threadButtonList) return urwid.Pile([listbox])
Example #3
Source File: indexFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def buildFrame(self): boardButtons = [] for subreddit in self.subredditList: subreddit = '/r/' + subreddit if not subreddit.startswith('/r/') else subreddit if self.uFilter: if self.uFilter.lower() in subreddit.lower(): boardButtons.append(urwid.LineBox(urwid.AttrWrap(urwid.Button(subreddit, self.changeFrameBoard), 'center'))) else: boardButtons.append(urwid.LineBox(urwid.AttrWrap(urwid.Button(subreddit, self.changeFrameBoard), 'center'))) self.parsedItems = len(boardButtons) width = len(max(self.subredditList, key=len)) buttonGrid = urwid.GridFlow(boardButtons, width + 9, 2, 2, 'center') # add 9 to width to account for widget padding listbox_content = [buttonGrid] return urwid.ListBox(urwid.SimpleListWalker(listbox_content))
Example #4
Source File: ui_elements.py From vpngate-with-proxy with GNU General Public License v2.0 | 6 votes |
def __init__(self, key=None, value=('', '')): self.trigger = key self.yn = value[0] self.yn_but = MyButton([('attention', 'Use proxy: '), self.yn], self.on_change) self.input_addr = urwid.Edit(('attention', u' \N{BULLET} Address : '), edit_text=value[1], wrap='clip') self.input_port = urwid.IntEdit(('attention', u' \N{BULLET} Port : '), default=value[2]) self.input_port.set_wrap_mode('clip') exit_but = urwid.Padding(urwid.Button('OKay'.center(8), self.item_callback), 'center', 12) widgets = [self.yn_but] \ + [urwid.AttrMap(wid, None, 'popbgs') for wid in (self.input_addr, self.input_port, exit_but)] self.pile = urwid.Pile(widgets) fill = urwid.LineBox(urwid.Filler(self.pile)) self.__super.__init__(urwid.AttrWrap(fill, 'popbg')) self.chosen = value
Example #5
Source File: views.py From zulip-terminal with Apache License 2.0 | 6 votes |
def __init__(self, controller: Any, question: Any, success_callback: Callable[[], bool]): self.controller = controller self.success_callback = success_callback yes = urwid.Button('Yes', self.exit_popup_yes) no = urwid.Button('No', self.exit_popup_no) yes._w = urwid.AttrMap(urwid.SelectableIcon( 'Yes', 4), None, 'selected') no._w = urwid.AttrMap(urwid.SelectableIcon( 'No', 4), None, 'selected') display_widget = urwid.GridFlow([yes, no], 3, 5, 1, 'center') wrapped_widget = urwid.WidgetWrap(display_widget) prompt = urwid.LineBox( urwid.ListBox( urwid.SimpleFocusListWalker( [question, urwid.Divider(), wrapped_widget] ))) urwid.Overlay.__init__(self, prompt, self.controller.view, align="left", valign="top", width=self.controller.view.LEFT_WIDTH + 1, height=8)
Example #6
Source File: songlist.py From clay with GNU General Public License v3.0 | 6 votes |
def _add_item(self, name, func): """ Add an item to the list with a divider. Args: name (str): The name of the option func: The function to call afterwards """ self.options.append( urwid.AttrWrap( urwid.Divider(u'\u2500'), 'panel_divider', 'panel_divider_focus')) self.options.append( urwid.AttrWrap( urwid.Button(name, on_press=func), 'panel', 'panel_focus'))
Example #7
Source File: storyFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def buildFrame(self, board): '''returns the board widget''' threadButtonList = [] for title, l, s, c, t in self.titles.items(): if self.uFilter: if re.search(self.uFilter.lower(), title.lower()): threadButton = urwid.Button(str(l), self.changeFrameThread) threadInfo = urwid.Text(self.info_text.format(str(s),str(c))) threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo] threadButtonList.append(urwid.LineBox(urwid.Pile(threadList))) else: threadButton = urwid.Button(str(l), self.changeFrameThread) threadInfo = urwid.Text(self.info_text.format(str(s),str(c))) threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo] threadButtonList.append(urwid.LineBox(urwid.Pile(threadList))) self.parsedItems = len(threadButtonList) catalogueButtons = urwid.GridFlow(threadButtonList, 30, 2, 2, 'center') listbox = urwid.ListBox(urwid.SimpleListWalker([catalogueButtons])) self.uvm.itemCount = len(threadButtonList) return [listbox]
Example #8
Source File: has_modal.py From Discurses with MIT License | 6 votes |
def open_confirm_prompt(self, callback, title="", content="", yestxt="Yes", notxt="No", align="center"): def create_cb(bool): def res(*k, **a): callback(bool) self.close_pop_up() return res self.open_pop_up( urwid.Filler(urwid.Text(content, align=align)), header=urwid.Text( title, align='center'), footer=urwid.Columns([ (urwid.Button(yestxt, create_cb(True))), (urwid.Button(notxt, create_cb(False))), ]), height=6, width=50) self._pop_up.set_focus("footer") logger.debug("Confirm prompt text: " + str(content))
Example #9
Source File: watcherFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def buildThread(self): watcherWidgetList = [] self.uvm.watcherUpdate(None, None) for wT, wTDict in self.uvm.watched.items(): if 'isArchived' in wTDict: wInfo = urwid.Text(f"Board: {wTDict['board']} -- {wTDict['op']} | THREAD ARCHIVED") else: wInfo = urwid.Text(f"Board: {wTDict['board']} -- {wTDict['op']} | Unread: {wTDict['numReplies']}") wButton = urwid.Button(f'View thread: {wT}', self.viewThread) dButton = urwid.Button(f'Unwatch thread: {wT}', self.unwatchThread) watcherWidgetList.append(urwid.LineBox(urwid.Pile([wInfo, urwid.Divider('-'), wButton, dButton]))) self.parsedItems = len(watcherWidgetList) listbox_content = watcherWidgetList listbox = urwid.ListBox(urwid.SimpleListWalker(listbox_content)) return listbox
Example #10
Source File: historyFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def buildThread(self): historyWidgetList = [] for h in self.uvm.history: frame = h[0] factory = h[1] args = h[2] if self.uFilter: if self.uFilter in args: hInfo = urwid.Text(f'Frame: {frame}, Info: {args}') hButton = urwid.Button(f'{self.uvm.history.index(h)}: Restore', self.restore) historyWidgetList.append(urwid.LineBox(urwid.Pile([hInfo, urwid.Divider('-'), hButton]))) else: hInfo = urwid.Text(f'Frame: {frame}, Info: {args}') hButton = urwid.Button(f'{self.uvm.history.index(h)}: Restore', self.restore) historyWidgetList.append(urwid.LineBox(urwid.Pile([hInfo, urwid.Divider('-'), hButton]))) self.parsedItems = len(historyWidgetList) listbox_content = historyWidgetList listbox = urwid.ListBox(urwid.SimpleListWalker(listbox_content)) return listbox
Example #11
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def build(self): wlist = [] addnew = urwid.Button("Add") urwid.connect_signal(addnew, 'click', self._add_new_option) addnew = urwid.AttrWrap(addnew, 'selectable', 'butfocus') wlist.append(addnew) for attrib in getattr(self.row, self.metadata.colname): # list-like attribute entry = ListEntry(urwid.Columns( [(30, urwid.Text(str(attrib.type))), urwid.Text(unicode(attrib.value).encode("utf-8"))])) entry.attrname = attrib.type.name urwid.connect_signal(entry, 'activate', self._edit_option) urwid.connect_signal(entry, 'delete', self._delete) wlist.append(entry) listbox = urwid.ListBox(urwid.SimpleFocusListWalker(wlist)) return urwid.BoxAdapter(urwid.LineBox(listbox), max(7, len(wlist)+2))
Example #12
Source File: customUrwidClasses.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, urwidViewManager): uvm = urwidViewManager close_button = urwid.Button("that's pretty cool") urwid.connect_signal(close_button, 'click', lambda button:self._emit("close")) historyButtonList = [] for i in uvm.history: historyButtonList.append(urwid.Button(str(i), uvm.displayThread)) pile = urwid.Pile(historyButtonList) # pile = urwid.Pile([urwid.Text( # "^^ I'm attached to the widget that opened me. " # "Try resizing the window!\n"), close_button]) fill = urwid.Filler(pile) self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
Example #13
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def build(self): addnew = urwid.Button("Add") urwid.connect_signal(addnew, 'click', self._add_new_testequipment) addnew = urwid.AttrWrap(addnew, 'selectable', 'butfocus') wlist = [addnew] for te in getattr(self.environmentrow, self.metadata.colname): # list-like attribute entry = ListEntry( urwid.Text(self._stringify_te(te))) urwid.connect_signal(entry, 'activate', self._edit_testequipment) urwid.connect_signal(entry, 'delete', self._delete_testequipment) entry.testequipment = te if te.UUT: wlist.insert(1, entry) else: wlist.append(entry) listbox = urwid.ListBox(urwid.SimpleFocusListWalker(wlist)) return urwid.BoxAdapter(urwid.LineBox(listbox), max(7, len(wlist)+2))
Example #14
Source File: main.py From wikicurses with MIT License | 6 votes |
def edit(title): try: text, verify = wiki.init_edit(title) wiki.login() newtext = runEditor(text) if newtext == text: ex.notify('Edit Canceled: No Change') return def submit(button): closeOverlay() wiki.commit_edit(newtext, summary.edit_text, minor.get_state(), verify) openPage(title) def cancel(button): closeOverlay() summary = urwid.Edit('Summary: ') minor = urwid.CheckBox('Minor Edit') cancel_button = urwid.Button('Cancel', cancel) submit_button = urwid.Button('Submit', submit) pile = urwid.Pile([summary, minor, cancel_button, submit_button]) openOverlay(pile, 'Edit', 'pack') except WikiError as e: ex.notify('Error: ' + str(e))
Example #15
Source File: help_menu.py From s-tui with GNU General Public License v2.0 | 6 votes |
def __init__(self, return_fn): self.return_fn = return_fn self.help_message = HELP_MESSAGE self.time_out_ctrl = urwid.Text(self.help_message) cancel_button = urwid.Button(('Exit'), on_press=self.on_cancel) cancel_button._label.align = 'center' if_buttons = urwid.Columns([cancel_button]) title = urwid.Text(('bold text', u" Help Menu \n"), 'center') self.titles = [title, self.time_out_ctrl, if_buttons] self.main_window = urwid.LineBox(ViListBox(self.titles))
Example #16
Source File: screens.py From tildemush with GNU General Public License v3.0 | 6 votes |
def show_login(self): un = self.client.config.get('username') pw = self.client.config.get('password') if un and pw: asyncio.wait_for( asyncio.ensure_future(self.handle_login({'username':un, 'password':pw}), loop=self.loop), 60.0, loop=self.loop) else: un_field = FormField(caption='username: ', name='username') pw_field = FormField(caption='password: ', name='password', mask='~') submit_btn = urwid.Button('login! >') login_form = Form([un_field, pw_field], submit_btn) def wait_for_login(_): asyncio.wait_for( asyncio.ensure_future(self.handle_login(login_form.data), loop=self.loop), 60.0, loop=self.loop) urwid.connect_signal(submit_btn, 'click', wait_for_login) self.open_box(urwid.Filler(login_form))
Example #17
Source File: about_menu.py From s-tui with GNU General Public License v2.0 | 6 votes |
def __init__(self, return_fn): self.return_fn = return_fn self.about_message = ABOUT_MESSAGE self.time_out_ctrl = urwid.Text(self.about_message) cancel_button = urwid.Button('Exit', on_press=self.on_cancel) cancel_button._label.align = 'center' if_buttons = urwid.Columns([cancel_button]) title = urwid.Text(('bold text', u" About Menu \n"), 'center') self.titles = [title, self.time_out_ctrl, if_buttons] self.main_window = urwid.LineBox(ViListBox(self.titles))
Example #18
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def get_form_buttons(self, defaultdata=None, create=False): ok = urwid.Button("OK") urwid.connect_signal(ok, 'click', self._ok, defaultdata) ok = AM(ok, 'selectable', 'butfocus') cancel = urwid.Button("Cancel") urwid.connect_signal(cancel, 'click', self._cancel) cancel = AM(cancel, 'selectable', 'butfocus') l = [ok, cancel] if create: ok_edit = urwid.Button("OK and Edit") urwid.connect_signal(ok_edit, 'click', self._ok_and_edit, defaultdata) ok_edit = AM(ok_edit, 'selectable', 'butfocus') l = [ok, ok_edit, cancel] else: l = [ok, cancel] butgrid = urwid.GridFlow(l, 15, 3, 1, 'center') return urwid.Pile([urwid.Divider(), butgrid ], focus_item=1)
Example #19
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def build(self): # buttons done = urwid.Button("Done") urwid.connect_signal(done, 'click', self._done_multiselect) done = urwid.AttrWrap(done, 'selectable', 'butfocus') add = urwid.Button("Add New") urwid.connect_signal(add, 'click', self._add_new) add = urwid.AttrWrap(add, 'selectable', 'butfocus') cancel = urwid.Button("Cancel") urwid.connect_signal(cancel, 'click', self._cancel) cancel = urwid.AttrWrap(cancel, 'selectable', 'butfocus') # footer and header header = urwid.GridFlow([done, add, cancel], 15, 3, 1, 'center') footer = urwid.Padding(urwid.Text( ("popup", "Tab to button box to select buttons. Arrow keys transfer selection."))) body = self._build_body() return urwid.Frame(body, header=header, footer=footer, focus_part="body")
Example #20
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def build(self): # buttons done = urwid.Button("Done") urwid.connect_signal(done, 'click', self._done_multiselect) done = urwid.AttrWrap(done, 'selectable', 'butfocus') add = urwid.Button("Add New") urwid.connect_signal(add, 'click', self._add_new) add = urwid.AttrWrap(add, 'selectable', 'butfocus') cancel = urwid.Button("Cancel") urwid.connect_signal(cancel, 'click', self._cancel) cancel = urwid.AttrWrap(cancel, 'selectable', 'butfocus') # footer and header footer = urwid.GridFlow([done, add, cancel], 15, 3, 1, 'center') header = urwid.Padding(urwid.Text( ("popup", "Select multiple items. Tab to button box to select buttons. Arrow keys move selection."))) listbox = self._build_list() return urwid.Frame(listbox, header=header, footer=footer, focus_part="body")
Example #21
Source File: ui.py From yTermPlayer with GNU General Public License v3.0 | 6 votes |
def start_screen(self): #Ovrlay top screen at start txt1_1=urwid.Button("New playlist [Enter URL]") urwid.connect_signal(txt1_1, 'click', self.input_screen) txt1 = urwid.AttrMap(txt1_1,None,focus_map='reversed') txt2_2=urwid.Button("Load saved playlist") urwid.connect_signal(txt2_2, 'click', self.load_list_screen) txt2 = urwid.AttrMap(txt2_2,None,focus_map='reversed') start_list=urwid.SimpleFocusListWalker([txt1,txt2]) box=urwid.ListBox(start_list) selection=urwid.LineBox( box, title='', title_align='center', tlcorner='┌', tline='─', lline='│', trcorner='┐', blcorner='└', rline='│', bline='─', brcorner='┘' ) selection_with_padding=urwid.Padding(selection,left=2,right=2) return selection_with_padding
Example #22
Source File: ui.py From yTermPlayer with GNU General Public License v3.0 | 6 votes |
def input_screen(self,button): #overlay second screen after start case1 txt=urwid.Text("Enter the URL below: ") url_field=urwid.Edit(caption='', edit_text='', multiline=False, align='left', wrap='space', allow_tab=False, edit_pos=None, layout=None, mask=None) btn=urwid.Button("OK",user_data=None) url_button = urwid.AttrMap(btn,None,focus_map='reversed') urwid.connect_signal(btn, 'click', self.input_url,url_field) wid=urwid.Pile([txt,url_field,url_button]) new=urwid.Filler(urwid.AttrMap(wid, None, focus_map='')) ok_screen_box=urwid.LineBox( new, title='', title_align='center', tlcorner='┌', tline='─', lline='│', trcorner='┐', blcorner='└', rline='│', bline='─', brcorner='┘' ) self.top.original_widget=ok_screen_box
Example #23
Source File: ui.py From yTermPlayer with GNU General Public License v3.0 | 6 votes |
def load_list_screen(self,button): #overlay second screen after start case2 txt=urwid.Text("Choose from the following:- ") _list=self.player_object.get_saved_lists() saved_list=[] for every_list in _list: b=urwid.Button(str(every_list).rstrip(),user_data=None) urwid.connect_signal(b, 'click', self.list_load) saved_list.append(urwid.AttrMap(b,None,focus_map='reversed')) box=urwid.ListBox(urwid.SimpleFocusListWalker(saved_list)) list_box=urwid.LineBox( box, title='', title_align='center', tlcorner='┌', tline='─', lline='│', trcorner='┐', blcorner='└', rline='│', bline='─', brcorner='┘' ) list_box_padding=urwid.Padding(list_box,right=0,left=0) self.top.original_widget=list_box_padding
Example #24
Source File: widgets.py From pycopia with Apache License 2.0 | 6 votes |
def _create_relation_input(self): choices = dict(models.get_choices(self.session, self.modelclass, self.metadata.colname, None)) addnew = urwid.Button("Add New") urwid.connect_signal(addnew, 'click', self._add_new_related) # Cancel canc = urwid.Button("Cancel") urwid.connect_signal(canc, 'click', self._cancel) butcol = urwid.Columns([AM(addnew, "buttn", "buttnf"), AM(canc, "buttn", "buttnf")]) wlist = [butcol] if self.metadata.nullable: entry = ListEntry(urwid.Text("None (remove)")) urwid.connect_signal(entry, 'activate', self._single_select) wlist.append(entry) for pk, cname in choices.items(): entry = ListEntry(urwid.Text(cname)) urwid.connect_signal(entry, 'activate', self._single_select, pk) wlist.append(entry) listbox = urwid.ListBox(urwid.SimpleListWalker(wlist)) return urwid.BoxAdapter(urwid.LineBox(listbox), 9)
Example #25
Source File: base.py From ceph-ansible-copilot with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, label, on_press=None, user_data=None): self._label = ButtonLabel("") cols = urwid.Columns([ ('fixed', len(self.button_left), urwid.Text(self.button_left)), self._label, ('fixed', len(self.button_right), urwid.Text(self.button_right))], dividechars=1) super(urwid.Button, self).__init__(cols) if on_press: urwid.connect_signal(self, 'click', on_press, user_data) self.set_label(label) self._label.align = 'center'
Example #26
Source File: screens.py From tildemush with GNU General Public License v3.0 | 5 votes |
def show_register(self): info = ColorText('register a new account! password must be at least 12 characters long.\n') un_field = FormField(caption='username: ', name='username') pw_field = FormField(caption='password: ', name='password', mask='~') pw_confirm_field = FormField(caption='confirm password: ', name='confirm_password', mask='~') submit_btn = urwid.Button('register! >') register_form = Form([un_field, pw_field, pw_confirm_field], submit_btn) def wait_for_register(_): asyncio.wait_for( asyncio.ensure_future(self.handle_register(register_form.data), loop=self.loop), 60.0, loop=self.loop) urwid.connect_signal(submit_btn, 'click', wait_for_register) self.open_box(urwid.Filler(urwid.Pile([info, register_form])))
Example #27
Source File: dialog.py From redial with GNU General Public License v3.0 | 5 votes |
def show(self, loop): # Header header_text = urwid.Text('Select Public SSH Key to Copy', align='center') header = urwid.AttrMap(header_text, 'dialog') cancel_btn = urwid.Button('Cancel', self.on_cancel) cancel_btn = urwid.AttrWrap(cancel_btn, 'dialog_button', 'dialog_button_focus') footer = urwid.GridFlow([cancel_btn], 12, 1, 1, 'center') list_box = urwid.BoxAdapter(SSHListBox(on_enter=self.on_copy, body=self.ssh_keys_walker), 5) body = urwid.Filler( urwid.Pile([list_box, footer]) ) # Layout layout = urwid.Frame( body=body, header=header) layout = urwid.AttrWrap(layout, 'dialog') w = DialogOverlay( on_close=lambda: self.on_close(), on_enter=self.on_copy, top_w=urwid.AttrMap(urwid.LineBox(layout), "dialog"), bottom_w=loop.widget, align='center', width=40, valign='middle', height=10 ) loop.widget = w
Example #28
Source File: dialog.py From redial with GNU General Public License v3.0 | 5 votes |
def show(self, loop): # Header header_text = urwid.Text('Edit Folder' if self.target.name else "Add Folder", align='center') header = urwid.AttrMap(header_text, 'dialog') # Footer save_btn = urwid.Button('Save', self.on_save) save_btn = urwid.AttrWrap(save_btn, 'dialog_button', 'dialog_button_focus') cancel_btn = urwid.Button('Cancel', self.on_cancel) cancel_btn = urwid.AttrWrap(cancel_btn, 'dialog_button', 'dialog_button_focus') footer = urwid.GridFlow([save_btn, cancel_btn], 12, 1, 1, 'center') body = urwid.Filler( urwid.Pile([self.folder_name, footer]) ) # Layout layout = urwid.Frame( body, header=header) w = DialogOverlay( on_close=lambda: self.on_close(self.target), on_enter=self.on_save, top_w=urwid.AttrMap(urwid.LineBox(layout), "dialog"), bottom_w=loop.widget, align='center', width=40, valign='middle', height=10 ) loop.widget = w
Example #29
Source File: ui.py From tildemush with GNU General Public License v3.0 | 5 votes |
def menu_button(caption, callback): button = urwid.Button(" "+caption) urwid.connect_signal(button, 'click', callback) return urwid.AttrMap(button, None, focus_map='reversed')
Example #30
Source File: demo.py From anyMesh-Python with MIT License | 5 votes |
def __init__(self): body = [urwid.Edit("Target:"), urwid.Edit("Message:"), urwid.Button("Request", self.req_pressed), urwid.Button("Publish", self.pub_pressed)] super(MsgEntryListBox, self).__init__(urwid.SimpleFocusListWalker(body)) #THESE TWO ACTIONS WILL CAUSE ANYMESH TO SEND A MESSAGE - EITHER A PUBLISH OR A REQUEST