%toc_left% | %toc_right% |
Tag Section or Item Name {section_data} Hello World Example min Minimal Urwid Application text Text and Filler Widgets attr AttrWrap Widgets and Text Attributes resize Live Resizing Conversation Example edit Edit Widgets frlb Frame 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]%The get_input function will return "window resize" among keys pressed when the window is resized. It is a good idea to check for uppercase and lowercase letters on input to avoid confusing users.
%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]}