%toc_left% | %toc_right% |
The programs in this tutorial are available in your Urwid distribution. Run the command "./docgen_tutorial.py -s" to output the example scripts.
{contents}
Items in the list that follows are parsed by docgen_tutorial.py. Each item has a tag and a name, separated by a comma. Whitespace on either side of the comma is stripped.
Items without tags are new sections.
A --- separates the left and right columns in the table of contents.
Tag, Section or Item Name {section_data} , Hello World Example min, Minimal Urwid Application input, Handling Input attr, AttrMap Widgets and Text Attributes highcolors, High Color Modes , Conversation Example edit, Edit Widgets frlb, Events and ListBox Widgets lbcont, Modifying ListBox Content , Zen of ListBox lbscr, ListBox Focus and Scrolling lbdyn, Dynamic ListBox with List Walker lbfocus, Setting the Focus --- , Combining Widgets pile, Piling Widgets cols, Dividing into Columns grid, GridFlow Arrangement overlay, Overlay Widgets , Creating Custom Widgets wmod, Modifying Existing Widgets wanat, Anatomy of a Widget wsel, Creating Selectable Widgets wcur, Widgets Displaying the Cursor {/section_data}
{toc_section}
{toc_item}
{/toc_item}{section_head}
{section_body}
%example[0]%
%example[0]%
%example[0]%
%example[0]%
%example[0]%
%example[0]%
%example[0]%
%example[0]%
%example[0]%The above code creates a group of RadioButtons and provides a method to query the state of the buttons.
%example[0]%The above code implements two widget classes. Pudding is a flow widget and BoxPudding is a box widget. Pudding will render as much "Pudding" as will fit in a single row, and BoxPudding will render as much "Pudding" as will fit into the entire area given.
%example[1]%The NewPudding class behaves the same way as the Pudding class above, but in NewPudding you can change the way the widget appears by modifying only the display_widget method, whereas in the Pudding class you may have to modify both the render and rows methods.
%example[2]%MultiPudding will work in place of either Pudding or BoxPudding above. The number of elements in the size tuple determines whether the containing widget is expecting a flow widget or a box widget. {/body[wanat]}
%example[0]%The SelectablePudding widget will display its contents in uppercase when it is in focus, and it allows the user to "eat" the pudding by pressing each of the letters P, U, D, D, I, N and G on the keyboard. When the user has "eaten" all the pudding the widget will reset to its initial state.
%example[0]%CursorPudding will let the user move the cursor through the widget by pressing LEFT and RIGHT. The cursor must only be added to the canvas when the widget is in focus. The get_cursor_coords method must always return the same cursor coordinates that render does.
%example[1]%{/body[wcur]}