Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import urwid
class MyEdit(urwid.Edit):
def keypress(self, size, key):
if key == 'enter':
return True
urwid.Edit.keypress(self, size, key)
edit = MyEdit(edit_text='Press ENTER to see my problem!')
left = urwid.Text('left left left')
right = urwid.Text('right right right')
header = urwid.Columns([
('pack', urwid.AttrMap(left, 'left')),
urwid.AttrMap(edit, 'center'),
('pack', urwid.AttrMap(right, 'right')),
], dividechars=1)
frame = urwid.Frame(body=urwid.ListBox([]), header=header)
def unhandled_input(input_):
left.set_text('This does not fit into the left column :(, how can I keep it packed?')
palette = [
('left', '', '', '', '', '#600'),
('center', '', '', '', '', '#006'),
('right', '', '', '', '', '#060'),
loop = urwid.MainLoop(frame, palette, unhandled_input=unhandled_input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.