Created
March 23, 2014 23:05
-
-
Save bk2204/9731198 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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