\documentclass[draft,10pt]{book}
\usepackage{listings}
\usepackage{times}
\lstset{language=Python}
\title{urwid: A Wrapper to Python Curses Zen}
\begin{document}
\chapter{Concepts}
\section{Flow Widgets vs. Box Widgets}
Flow widgets can fill multiple rows depending on the number of columns available to them. When calling the render() function for a flow widget, the first parameter is a one-element tuple (columns,).
\begin{enumerate}
\item Text widget
\item Edit widget (which is based on a Text widget)
\end{enumerate}
A box widget has fixed dimensions, i.e. fixed rows and fixed columns. When one calls the render() function of a box widget, the first parameter is a two-element tuple (columns, rows). Examples of box widgets are:
\begin{enumerate}
\item Filler widgets
\item ListBox widgets
\end{enumerate}
\section{Atribute Wrappers}
Attribute wrappers take widgets as input and applies formatting attributes such as color or alignment. It is a decorator.
\section{Frame widgets}
A frame widget provides what in X window terms we would call window decorations; a frame around a certain widget.
\section{Working with Listboxes}
A listbox is a box widget, unsurprisingly. It takes a list of widgets as input, which populate the ListBox. To take an example:
\begin{lstlisting}
# three Text objects (flow widgets, remember?)
foo = urwid.Text("Hello, world!")
bar = urwid.Text("Hej, verden!")
zot = urwid.Text("Buon goirno, mondo!")
# Now, we stick them into a predictably named list (just a regular python list, nothing urwid-ic)
widgetList = (foo, bar, zot)
ourAmazingListbox = urwid.ListBox(widgetList)
\end{lstlisting}
\chapter{Edit widgets}
Edit widgets are little gizmos you can use for when the user needs to enter information.
\chapter{Three}
\chapter{Four}
\chapter{Five}
\chapter{Six}
\chapter{Seven}
\chapter{Eight}
\chapter{Nine}
\chapter{Ten}
\end{document}