Skip to content

Instantly share code, notes, and snippets.

@bk2204
Created March 23, 2014 23:05
Show Gist options
  • Save bk2204/9731198 to your computer and use it in GitHub Desktop.
Save bk2204/9731198 to your computer and use it in GitHub Desktop.
import urwid
def setup_cells():
layout = [0, None, None, 1, 2, 3, None, 4, None, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, None, 15, 16, None, 17, None]
cells = []
for item in layout:
if item is None:
pile = urwid.Pile([])
else:
pile = urwid.Pile([urwid.Text("Cell %d" % item), urwid.Edit()])
cells.append(pile)
return cells
def setup_grid(loop):
width = int((loop.screen.get_cols_rows()[0] - 2) / 3)
return urwid.GridFlow(setup_cells(), width, 1, 1, "left")
def main():
loop = urwid.MainLoop(None)
widget = urwid.Filler(setup_grid(loop))
loop.widget = widget
loop.run()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment