Urwid 0.9.8.1 Reference

Urwid Home Page / Example Screenshots / UTF-8 Screenshots / Tutorial / Reference

User interface wrappers
Top-level widgets
Frame [B]
Filler [B]
Decorations
AttrWrap [F/B]
Padding [F/B]
LineBox [F/B]
Composite widgets
Columns [F/B]
Pile [F/B]
Content widgets
Text [F]
Edit [F]
Button [F]
Graphics
Abstract widgets & interfaces
ListBox list walkers
Canvas painting
Custom formatting rules
Character encoding
Screen capture
Web Application Interface

[F] = Flow Widget displayed with assigned screen columns and variable screen rows
[B] = Box Widget displayed with assigned screen columns and assigned screen rows
[F/B] = May behave as either Flow Widget or Box Widget
[X] = Fixed Widget has a fixed number of screen columns and rows

User interface wrappers

function raw_display.Screen [back to top]

raw_display.Screen [back to top]

Methods defined here:
__init__(self)
clear(self)
Force the screen to be completely repainted on the next
call to draw_screen().
draw_screen(self, (maxcol, maxrow), r)
Paint screen with rendered canvas.
get_cols_rows(self)
Return the terminal dimensions (num columns, num rows).
get_input(self, raw_keys=False)
Return pending input as a list.
 
raw_keys -- return raw keycodes as well as translated versions
 
This function will immediately return all the input since the
last time it was called.  If there is no input pending it will
wait before returning an empty list.  The wait time may be
configured with the set_input_timeouts function.
 
If raw_keys is False (default) this function will return a list
of keys pressed.  If raw_keys is True this function will return
a ( keys pressed, raw keycodes ) tuple instead.
 
Examples of keys returned
-------------------------
ASCII printable characters:  " ", "a", "0", "A", "-", "/" 
ASCII control characters:  "tab", "enter"
Escape sequences:  "up", "page up", "home", "insert", "f1"
Key combinations:  "shift f1", "meta a", "ctrl b"
Window events:  "window resize"
 
When a narrow encoding is not enabled
"Extended ASCII" characters:  "\xa1", "\xb2", "\xfe"
 
When a wide encoding is enabled
Double-byte characters:  "\xa1\xea", "\xb2\xd4"
 
When utf8 encoding is enabled
Unicode characters: u"\u00a5", u'\u253c"
 
Examples of mouse events returned
---------------------------------
Mouse button press: ('mouse press', 1, 15, 13), 
                    ('meta mouse press', 2, 17, 23)
Mouse drag: ('mouse drag', 1, 16, 13),
            ('mouse drag', 1, 17, 13),
            ('ctrl mouse drag', 1, 18, 13)
Mouse button release: ('mouse release', 0, 18, 13),
                      ('ctrl mouse release', 0, 17, 23)
get_input_descriptors(self)
Return a list of integer file descriptors that should be
polled in external event loops to check for user input.
 
Use this method if you are implementing yout own event loop.
get_input_nonblocking(self)
Return a (next_input_timeout, keys_pressed, raw_keycodes) 
tuple.
 
Use this method if you are implementing your own event loop.
 
When there is input waiting on one of the descriptors returned
by get_input_descriptors() this method should be called to
read and process the input.
 
This method expects to be called in next_input_timeout seconds
(a floating point number) if there is no input waiting.
register_palette(self, l)
Register a list of palette entries.
 
l -- list of (name, foreground, background, mono),
     (name, foreground, background) or
     (name, same_as_other_name) palette entries.
 
calls self.register_palette_entry for each item in l
register_palette_entry(self, name, foreground, background, mono=None)
Register a single palette entry.
 
name -- new entry/attribute name
foreground -- foreground colour, one of: 'black', 'dark red',
        'dark green', 'brown', 'dark blue', 'dark magenta',
        'dark cyan', 'light gray', 'dark gray', 'light red',
        'light green', 'yellow', 'light blue', 'light magenta',
        'light cyan', 'white', 'default' (black if unable to
        use terminal's default)
background -- background colour, one of: 'black', 'dark red',
        'dark green', 'brown', 'dark blue', 'dark magenta',
        'dark cyan', 'light gray', 'default' (light gray if
        unable to use terminal's default)
mono -- monochrome terminal attribute, one of: None (default),
        'bold', 'underline', 'standout', or a tuple containing
        a combination eg. ('bold','underline')
run_wrapper(self, fn, alternate_buffer=True)
Call start to initialize screen, then call fn.  
When fn exits call stop to restore the screen to normal.
 
alternate_buffer -- use alternate screen buffer and restore
        normal screen buffer on exit
set_input_timeouts(self, max_wait=0.5, complete_wait=0.10000000000000001, resize_wait=0.10000000000000001)
Set the get_input timeout values.  All values have are floating
point number of seconds.
 
max_wait -- amount of time in seconds to wait for input when
        there is no input pending
complete_wait -- amount of time in seconds to wait when
        get_input detects an incomplete escape sequence at the
        end of the available input
resize_wait -- amount of time in seconds to wait for more input
        after receiving two screen resize requests in a row to
        stop Urwid from consuming 100% cpu during a gradual
        window resize operation
set_mouse_tracking(self)
Enable mouse tracking.  
 
After calling this function get_input will include mouse
click events along with keystrokes.
signal_init(self)
Called in the startup of run wrapper to set the SIGWINCH 
signal handler to self._sigwinch_handler.
 
Override this function to call from main thread in threaded
applications.
signal_restore(self)
Called in the finally block of run wrapper to restore the
SIGWINCH handler to the default handler.
 
Override this function to call from main thread in threaded
applications.
start(self, alternate_buffer=True)
Initialize the screen and input mode.
 
alternate_buffer -- use alternate screen buffer
stop(self)
Restore the screen.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

function curses_display.Screen [back to top]

curses_display.Screen [back to top]

Methods defined here:
__init__(self)
clear(self)
Force the screen to be completely repainted on the next
call to draw_screen().
draw_screen(self, (cols, rows), r)
Paint screen with rendered canvas.
get_cols_rows(self)
Return the terminal dimensions (num columns, num rows).
get_input(self, raw_keys=False)
Return pending input as a list.
 
raw_keys -- return raw keycodes as well as translated versions
 
This function will immediately return all the input since the
last time it was called.  If there is no input pending it will
wait before returning an empty list.  The wait time may be
configured with the set_input_timeouts function.
 
If raw_keys is False (default) this function will return a list
of keys pressed.  If raw_keys is True this function will return
a ( keys pressed, raw keycodes ) tuple instead.
 
Examples of keys returned
-------------------------
ASCII printable characters:  " ", "a", "0", "A", "-", "/" 
ASCII control characters:  "tab", "enter"
Escape sequences:  "up", "page up", "home", "insert", "f1"
Key combinations:  "shift f1", "meta a", "ctrl b"
Window events:  "window resize"
 
When a narrow encoding is not enabled
"Extended ASCII" characters:  "\xa1", "\xb2", "\xfe"
 
When a wide encoding is enabled
Double-byte characters:  "\xa1\xea", "\xb2\xd4"
 
When utf8 encoding is enabled
Unicode characters: u"\u00a5", u'\u253c"
 
Examples of mouse events returned
---------------------------------
Mouse button press: ('mouse press', 1, 15, 13), 
                    ('meta mouse press', 2, 17, 23)
Mouse button release: ('mouse release', 0, 18, 13),
                      ('ctrl mouse release', 0, 17, 23)
register_palette(self, l)
Register a list of palette entries.
 
l -- list of (name, foreground, background, mono),
     (name, foreground, background) or
     (name, same_as_other_name) palette entries.
 
calls self.register_palette_entry for each item in l
register_palette_entry(self, name, foreground, background, mono=None)
Register a single palette entry.
 
name -- new entry/attribute name
foreground -- foreground colour, one of: 'black', 'dark red',
        'dark green', 'brown', 'dark blue', 'dark magenta',
        'dark cyan', 'light gray', 'dark gray', 'light red',
        'light green', 'yellow', 'light blue', 'light magenta',
        'light cyan', 'white', 'default' (black if unable to
        use terminal's default)
background -- background colour, one of: 'black', 'dark red',
        'dark green', 'brown', 'dark blue', 'dark magenta',
        'dark cyan', 'light gray', 'default' (light gray if
        unable to use terminal's default)
mono -- monochrome terminal attribute, one of: None (default),
        'bold', 'underline', 'standout', or a tuple containing
        a combination eg. ('bold','underline')
run_wrapper(self, fn)
Call fn in fullscreen mode.  Return to normal on exit.
 
This function should be called to wrap your main program loop.
Exception tracebacks will be displayed in normal mode.
set_input_timeouts(self, max_wait=0.5, complete_wait=0.10000000000000001, resize_wait=0.10000000000000001)
Set the get_input timeout values.  All values have a granularity
of 0.1s, ie. any value between 0.15 and 0.05 will be treated as
0.1 and any value less than 0.05 will be treated as 0. 
 
max_wait -- amount of time in seconds to wait for input when
        there is no input pending
complete_wait -- amount of time in seconds to wait when
        get_input detects an incomplete escape sequence at the
        end of the available input
resize_wait -- amount of time in seconds to wait for more input
        after receiving two screen resize requests in a row to
        stop urwid from consuming 100% cpu during a gradual
        window resize operation
set_mouse_tracking(self)
Enable mouse tracking.  
 
After calling this function get_input will include mouse
click events along with keystrokes.
start(self)
Initialize the screen and input mode.
stop(self)
Restore the screen.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

web_display.Screen [back to top]

Methods defined here:
__init__(self)
clear(self)
Force the screen to be completely repainted on the next
call to draw_screen().
 
(does nothing for web_display)
draw_screen(self, (cols, rows), r)
Send a screen update to the client.
get_cols_rows(self)
Return the screen size.
get_input(self, raw_keys=False)
Return pending input as a list.
register_palette(self, l)
Register a list of palette entries.
 
l -- list of (name, foreground, background) or
     (name, same_as_other_name) palette entries.
 
calls self.register_palette_entry for each item in l
register_palette_entry(self, name, foreground, background, mono=None)
Register a single palette entry.
 
name -- new entry/attribute name
foreground -- foreground colour
background -- background colour
mono -- monochrome terminal attribute
 
See curses_display.register_palette_entry for more info.
run_wrapper(self, fn)
Run the application main loop, calling start() first
and stop() on exit.
set_mouse_tracking(self)
Not yet implemented
start(self)
This function reads the initial screen size, generates a
unique id and handles cleanup when fn exits.
 
web_display.set_preferences(..) must be called before calling
this function for the preferences to take effect
stop(self)
Restore settings and clean up.

Top-level widgets

function Frame [back to top]

class Frame(BoxWidget) [back to top]

Method resolution order:
Frame
BoxWidget
Widget
object

Methods defined here:
__init__(self, body, header=None, footer=None, focus_part='body')
body -- a box widget for the body of the frame
header -- a flow widget for above the body (or None)
footer -- a flow widget for below the body (or None)
focus_part -- 'header', 'footer' or 'body'
frame_top_bottom(self, (maxcol, maxrow), focus)
Calculate the number of rows for the header and footer.
 
Returns (head rows, foot rows),(orig head, orig foot).
orig head/foot are from rows() calls.
get_body(self)
get_footer(self)
get_header(self)
keypress(self, (maxcol, maxrow), key)
Pass keypress to widget in focus.
mouse_event(self, (maxcol, maxrow), event, button, col, row, focus)
Pass mouse event to appropriate part of frame.
Focus may be changed on button 1 press.
render = cached_render(self, size, focus=False)
set_body(self, body)
set_focus(self, part)
Set the part of the frame that is in focus.
 
part -- 'header', 'footer' or 'body'
set_footer(self, footer)
set_header(self, header)

Data descriptors defined here:
body
footer
header

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Filler [back to top]

class Filler(BoxWidget) [back to top]

Method resolution order:
Filler
BoxWidget
Widget
object

Methods defined here:
__init__(self, body, valign='middle', height=None, min_height=None)
body -- a flow widget or box widget to be filled around
valign -- one of:
    'top', 'middle', 'bottom'
    ('fixed top', rows)
    ('fixed bottom', rows)
    ('relative', percentage 0=top 100=bottom)
height -- one of:
    None if body is a flow widget
    number of rows high 
    ('fixed bottom', rows)  Only if valign is 'fixed top'
    ('fixed top', rows)  Only if valign is 'fixed bottom'
    ('relative', percentage of total height)
min_height -- one of:
    None if no minimum or if body is a flow widget
    minimum number of rows for the widget when height not fixed
 
If body is a flow widget then height and min_height must be set
to None.
 
Filler widgets will try to satisfy height argument first by
reducing the valign amount when necessary.  If height still 
cannot be satisfied it will also be reduced.
filler_values(self, (maxcol, maxrow), focus)
Return the number of rows to pad on the top and bottom.
 
Override this method to define custom padding behaviour.
get_cursor_coords(self, (maxcol, maxrow))
Return cursor coords from self.body if any.
get_pref_col(self, (maxcol, maxrow))
Return pref_col from self.body if any.
keypress(self, (maxcol, maxrow), key)
Pass keypress to self.body.
mouse_event(self, (maxcol, maxrow), event, button, col, row, focus)
Pass to self.body.
move_cursor_to_coords(self, (maxcol, maxrow), col, row)
Pass to self.body.
render = cached_render(self, size, focus=False)
selectable(self)
Return selectable from body.

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function ListBox [back to top]

class ListBox(BoxWidget) [back to top]

Method resolution order:
ListBox
BoxWidget
Widget
object

Methods defined here:
__init__(self, body)
body -- a ListWalker-like object that contains
        widgets to be displayed inside the list box
calculate_visible(self, (maxcol, maxrow), focus=False)
Return (middle,top,bottom) or None,None,None.
 
middle -- ( row offset(when +ve) or inset(when -ve),
        focus widget, focus position, focus rows, 
        cursor coords or None )
top -- ( # lines to trim off top, 
        list of (widget, position, rows) tuples above focus
        in order from bottom to top )
bottom -- ( # lines to trim off bottom, 
        list of (widget, position, rows) tuples below focus
        in order from top to bottom )
change_focus(self, (maxcol, maxrow), position, offset_inset=0, coming_from=None, cursor_coords=None, snap_rows=None)
Change the current focus widget.
 
position -- a position compatible with self.body.set_focus
offset_inset_rows -- either the number of rows between the 
  top of the listbox and the start of the focus widget (+ve
  value) or the number of lines of the focus widget hidden off 
  the top edge of the listbox (-ve value) or 0 if the top edge
  of the focus widget is aligned with the top edge of the
  listbox (default if unspecified)
coming_from -- eiter 'above', 'below' or unspecified (None)
cursor_coords -- (x, y) tuple indicating the desired
  column and row for the cursor, a (x,) tuple indicating only
  the column for the cursor, or unspecified (None)
snap_rows -- the maximum number of extra rows to scroll
  when trying to "snap" a selectable focus into the view
ends_visible(self, (maxcol, maxrow), focus=False)
Return a list that may contain 'top' and/or 'bottom'.
 
convenience function for checking whether the top and bottom
of the list are visible
get_focus(self)
Return a (focus widget, focus position) tuple.
get_focus_offset_inset(self, (maxcol, maxrow))
Return (offset rows, inset rows) for focus widget.
keypress(self, (maxcol, maxrow), key)
Move selection through the list elements scrolling when 
necessary. 'up' and 'down' are first passed to widget in focus
in case that widget can handle them. 'page up' and 'page down'
are always handled by the ListBox.
 
Keystrokes handled by this widget are:
 'up'        up one line (or widget)
 'down'      down one line (or widget)
 'page up'   move cursor up one listbox length
 'page down' move cursor down one listbox length
make_cursor_visible(self, (maxcol, maxrow))
Shift the focus widget so that its cursor is visible.
mouse_event(self, (maxcol, maxrow), event, button, col, row, focus)
Pass the event to the contained widgets.
May change focus on button 1 press.
render = cached_render(self, size, focus=False)
set_focus(self, position, coming_from=None)
Set the focus position and try to keep the old focus in view.
 
position -- a position compatible with self.body.set_focus
coming_from -- set to 'above' or 'below' if you know that
               old position is above or below the new position.
set_focus_valign(self, valign)
Set the focus widget's display offset and inset.
 
valign -- one of:
        'top', 'middle', 'bottom'
        ('fixed top', rows)
        ('fixed bottom', rows)
        ('relative', percentage 0=top 100=bottom)
shift_focus(self, (maxcol, maxrow), offset_inset)
Move the location of the current focus relative to the top.
 
offset_inset -- either the number of rows between the 
  top of the listbox and the start of the focus widget (+ve
  value) or the number of lines of the focus widget hidden off 
  the top edge of the listbox (-ve value) or 0 if the top edge
  of the focus widget is aligned with the top edge of the
  listbox
update_pref_col_from_focus(self, (maxcol, maxrow))
Update self.pref_col from the focus widget.

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

Decorations

function WidgetWrap [back to top]

class WidgetWrap(Widget) [back to top]

Method resolution order:
WidgetWrap
Widget
object

Methods defined here:
__getattr__(self, name)
Call self.w if name is in Widget interface definition.
__init__(self, w)
w -- widget to wrap, stored as self.w
 
This object will pass the functions defined in Widget interface
definition to self.w.
get_w(self)
render = cached_render(self, size, focus=False)
selectable(self)
set_w(self, w)

Data descriptors defined here:
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function AttrWrap [back to top]

class AttrWrap(Widget) [back to top]

Method resolution order:
AttrWrap
Widget
object

Methods defined here:
__getattr__(self, name)
Call getattr on wrapped widget.
__init__(self, w, attr, focus_attr=None)
w -- widget to wrap
attr -- attribute to apply to w
focus_attr -- attribute to apply when in focus, if None use attr
 
This object will pass all function calls and variable references
to the wrapped widget.
get_attr(self)
get_focus_attr(self)
get_w(self)
render = cached_render(self, size, focus=False)
selectable(self)
set_attr(self, attr)
set_focus_attr(self, focus_attr)
set_w(self, w)

Data descriptors defined here:
attr
focus_attr
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Padding [back to top]

class Padding(Widget) [back to top]

Method resolution order:
Padding
Widget
object

Methods defined here:
__init__(self, w, align, width, min_width=None)
w -- a box, flow or fixed widget to pad on the left and/or right
align -- one of:
    'left', 'center', 'right'
    ('fixed left', columns)
    ('fixed right', columns)
    ('relative', percentage 0=left 100=right)
width -- one of:
    number of columns wide 
    ('fixed right', columns)  Only if align is 'fixed left'
    ('fixed left', columns)  Only if align is 'fixed right'
    ('relative', percentage of total width)
    None   to enable clipping mode
min_width -- the minimum number of columns for w or None
        
Padding widgets will try to satisfy width argument first by
reducing the align amount when necessary.  If width still 
cannot be satisfied it will also be reduced.
 
Clipping Mode:
In clipping mode w is treated as a fixed widget and this 
widget expects to be treated as a flow widget.  w will
be clipped to fit within the space given.  For example,
if align is 'left' then w may be clipped on the right.
get_cursor_coords(self, size)
Return the (x,y) coordinates of cursor within self.w.
get_pref_col(self, size)
Return the preferred column from self.w, or None.
keypress(self, size, key)
Pass keypress to self.w.
mouse_event(self, size, event, button, x, y, focus)
Send mouse event if position is within self.w.
move_cursor_to_coords(self, size, x, y)
Set the cursor position with (x,y) coordinates of self.w.
 
Returns True if move succeeded, False otherwise.
padding_values(self, size, focus)
Return the number of columns to pad on the left and right.
 
Override this method to define custom padding behaviour.
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
selectable(self)
Return the selectable value of self.w.

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Divider [back to top]

class Divider(FlowWidget) [back to top]

Method resolution order:
Divider
FlowWidget
Widget
object

Methods defined here:
__init__(self, div_char=' ', top=0, bottom=0)
div_char -- character to repeat across line
top -- number of blank lines above
bottom -- number of blank lines below
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function LineBox [back to top]

class LineBox(WidgetWrap) [back to top]

Method resolution order:
LineBox
WidgetWrap
Widget
object

Methods defined here:
__init__(self, w)
Draw a line around w.

Methods inherited from WidgetWrap:
__getattr__(self, name)
Call self.w if name is in Widget interface definition.
get_w(self)
render = cached_render(self, size, focus=False)
selectable(self)
set_w(self, w)

Data descriptors inherited from WidgetWrap:
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function SolidFill [back to top]

class SolidFill(BoxWidget) [back to top]

Method resolution order:
SolidFill
BoxWidget
Widget
object

Methods defined here:
__init__(self, fill_char=' ')
fill_char -- character to fill area with
render = cached_render(self, size, focus=False)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

Composite widgets

function Columns [back to top]

class Columns(Widget) [back to top]

Method resolution order:
Columns
Widget
object

Methods defined here:
__init__(self, widget_list, dividechars=0, focus_column=None, min_width=1, box_columns=None)
widget_list -- list of flow widgets or list of box widgets
dividechars -- blank characters between columns
focus_column -- index into widget_list of column in focus,
        if None the first selectable widget will be chosen.
min_width -- minimum width for each column before it is hidden
box_columns -- a list of column indexes containing box widgets
        whose maxrow is set to the maximum of the rows 
        required by columns not listed in box_columns.
 
widget_list may also contain tuples such as:
('fixed', width, widget) give this column a fixed width
('weight', weight, widget) give this column a relative weight
 
widgets not in a tuple are the same as ('weight', 1, widget)    
 
box_columns is ignored when this widget is being used as a
box widget because in that case all columns are treated as box
widgets.
column_widths(self, size)
Return a list of column widths.
 
size -- (maxcol,) if self.widget_list contains flow widgets or
        (maxcol, maxrow) if it contains box widgets.
get_cursor_coords(self, size)
Return the cursor coordinates from the focus widget.
get_focus(self)
Return the widget in focus.
get_focus_column(self)
Return the focus column index.
get_pref_col(self, size)
Return the pref col from the column in focus.
keypress(self, size, key)
Pass keypress to the focus column.
 
size -- (maxcol,) if self.widget_list contains flow widgets or
        (maxcol, maxrow) if it contains box widgets.
mouse_event(self, size, event, button, col, row, focus)
Send event to appropriate column.
May change focus on button 1 press.
move_cursor_to_coords(self, size, col, row)
Choose a selectable column to focus based on the coords.
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
selectable(self)
Return the selectable value of the focus column.
set_focus(self, item)
Set the item in focus.  
 
item -- widget or integer index
set_focus_column(self, num)
Set the column in focus by its index in self.widget_list.

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Pile [back to top]

class Pile(Widget) [back to top]

Method resolution order:
Pile
Widget
object

Methods defined here:
__init__(self, widget_list, focus_item=None)
widget_list -- list of widgets
focus_item -- widget or integer index, if None the first
        selectable widget will be chosen.
 
widget_list may also contain tuples such as:
('flow', widget) always treat widget as a flow widget
('fixed', height, widget) give this box widget a fixed height
('weight', weight, widget) if the pile is treated as a box
        widget then treat widget as a box widget with a
        height based on its relative weight value, otherwise
        treat widget as a flow widget
 
widgets not in a tuple are the same as ('weight', 1, widget)
 
If the pile is treated as a box widget there must be at least
one 'weight' tuple in widget_list.
get_cursor_coords(self, size)
Return the cursor coordinates of the focus widget.
get_focus(self)
Return the widget in focus.
get_item_rows(self, size, focus)
Return a list of the number of rows used by each widget
in self.item_list.
get_item_size(self, size, i, focus, item_rows=None)
Return a size appropriate for passing to self.widget_list[i]
get_pref_col(self, size)
Return the preferred column for the cursor, or None.
keypress(self, size, key)
Pass the keypress to the widget in focus.
Unhandled 'up' and 'down' keys may cause a focus change.
mouse_event(self, size, event, button, col, row, focus)
Pass the event to the contained widget.
May change focus on button 1 press.
move_cursor_to_coords(self, size, col, row)
Capture pref col and set new focus.
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
selectable(self)
Return True if the focus item is selectable.
set_focus(self, item)
Set the item in focus.  
 
item -- widget or integer index

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function GridFlow [back to top]

class GridFlow(FlowWidget) [back to top]

Method resolution order:
GridFlow
FlowWidget
Widget
object

Methods defined here:
__init__(self, cells, cell_width, h_sep, v_sep, align)
cells -- list of flow widgets to display
cell_width -- column width for each cell
h_sep -- blank columns between each cell horizontally
v_sep -- blank rows between cells vertically (if more than
         one row is required to display all the cells)
align -- horizontal alignment of cells, see "align" parameter
         of Padding widget for available options
generate_display_widget(self, (maxcol,))
Actually generate display widget (ignoring cache)
get_cursor_coords(self, (maxcol,))
Get cursor from display widget.
get_display_widget(self, (maxcol,))
Arrange the cells into columns (and possibly a pile) for 
display, input or to calculate rows.
get_pref_col(self, (maxcol,))
Return pref col from display widget.
keypress(self, (maxcol,), key)
Pass keypress to display widget for handling.  
Capture focus changes.
mouse_event(self, (maxcol,), event, button, col, row, focus)
Send mouse event to contained widget.
move_cursor_to_coords(self, (maxcol,), col, row)
Set the widget in focus based on the col + row.
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
selectable(self)
Return True if the cell in focus is selectable.
set_focus(self, cell)
Set the cell in focus.  
 
cell -- widget or integer index into self.cells

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function BoxAdapter [back to top]

class BoxAdapter(FlowWidget) [back to top]

Method resolution order:
BoxAdapter
FlowWidget
Widget
object

Methods defined here:
__getattr__(self, name)
Pass calls to box widget.
__init__(self, box_widget, height)
Create a flow widget that contains a box widget
 
box_widget -- box widget
height -- number of rows for box widget
get_cursor_coords(self, (maxcol,))
get_pref_col(self, (maxcol,))
keypress(self, (maxcol,), key)
mouse_event(self, (maxcol,), event, button, col, row, focus)
move_cursor_to_coords(self, (maxcol,), col, row)
render = cached_render(self, size, focus=False)
rows(self, (maxcol,), focus=False)
Return self.height
selectable(self)
Return box widget's selectable value

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Overlay [back to top]

class Overlay(BoxWidget) [back to top]

Method resolution order:
Overlay
BoxWidget
Widget
object

Methods defined here:
__init__(self, top_w, bottom_w, align, width, valign, height, min_width=None, min_height=None)
top_w -- a flow, box or fixed widget to overlay "on top"
bottom_w -- a box widget to appear "below" previous widget
align -- one of:
    'left', 'center', 'right'
    ('fixed left', columns)
    ('fixed right', columns)
    ('relative', percentage 0=left 100=right)
width -- one of:
    None if top_w is a fixed widget
    number of columns wide
    ('fixed right', columns)  Only if align is 'fixed left'
    ('fixed left', columns)  Only if align is 'fixed right'
    ('relative', percentage of total width)
valign -- one of:
    'top', 'middle', 'bottom'
    ('fixed top', rows)
    ('fixed bottom', rows)
    ('relative', percentage 0=top 100=bottom)
height -- one of:
    None if top_w is a flow or fixed widget
    number of rows high 
    ('fixed bottom', rows)  Only if valign is 'fixed top'
    ('fixed top', rows)  Only if valign is 'fixed bottom'
    ('relative', percentage of total height)
min_width -- the minimum number of columns for top_w
    when width is not fixed
min_height -- one of:
    minimum number of rows for the widget when height not fixed
 
Overlay widgets behave similarly to Padding and Filler widgets
when determining the size and position of top_w.  bottom_w is
always rendered the full size available "below" top_w.
calculate_padding_filler(self, (maxcol, maxrow), focus)
Return (padding left, right, filler top, bottom).
get_cursor_coords(self, size)
Return cursor coords from top_w, if any.
keypress(self, size, key)
Pass keypress to top_w.
mouse_event(self, size, event, button, col, row, focus)
Pass event to top_w, ignore if outside of top_w.
render = cached_render(self, size, focus=False)
selectable(self)
Return selectable from top_w.
top_w_size(self, size, left, right, top, bottom)
Return the size to pass to top_w.

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

Content widgets

function Text [back to top]

class Text(FlowWidget) [back to top]

Method resolution order:
Text
FlowWidget
Widget
object

Methods defined here:
__init__(self, markup, align='left', wrap='space', layout=None)
markup -- content of text widget, one of:
        plain string -- string is displayed
        ( attr, markup2 ) -- markup2 is given attribute attr
        [ markupA, markupB, ... ] -- list items joined together
align -- align mode for text layout
wrap -- wrap mode for text layout
layout -- layout object to use, defaults to StandardTextLayout
get_line_translation(self, maxcol, ta=None)
Return layout structure for mapping self.text to a canvas.
get_text(self)
Returns (text, attributes).
 
text -- complete string content of text widget
attributes -- run length encoded attributes for text
pack(self, size=None, focus=False)
Return the number of screen columns required for this Text
widget to be displayed without wrapping or clipping, as a 
single element tuple.
 
size -- None for unlimited screen columns or (maxcol,) to
        specify a maximum column size
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
set_align_mode(self, mode)
Set text alignment / justification.  
 
Valid modes for StandardTextLayout are: 
        'left', 'center' and 'right'
set_layout(self, align, wrap, layout=None)
Set layout object, align and wrap modes.
 
align -- align mode for text layout
wrap -- wrap mode for text layout
layout -- layout object to use, defaults to StandardTextLayout
set_text(self, markup)
Set content of text widget.
set_wrap_mode(self, mode)
Set wrap mode.  
 
Valid modes for StandardTextLayout are :
        'any'   : wrap at any character
        'space' : wrap on space character
        'clip'  : truncate lines instead of wrapping

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Edit [back to top]

class Edit(Text) [back to top]

Method resolution order:
Edit
Text
FlowWidget
Widget
object

Methods defined here:
__init__(self, caption='', edit_text='', multiline=False, align='left', wrap='space', allow_tab=False, edit_pos=None, layout=None)
caption -- markup for caption preceeding edit_text
edit_text -- text string for editing
multiline -- True: 'enter' inserts newline  False: return it
align -- align mode
wrap -- wrap mode
allow_tab -- True: 'tab' inserts 1-8 spaces  False: return it
edit_pos -- initial position for cursor, None:at end
layout -- layout object
get_cursor_coords(self, (maxcol,))
Return the (x,y) coordinates of cursor within widget.
get_edit_text(self)
Return the edit text for this widget.
get_line_translation(self, maxcol, ta=None)
get_pref_col(self, (maxcol,))
Return the preferred column for the cursor, or the
current cursor x value.
get_text(self)
get_text() -> text, attributes
 
text -- complete text of caption and edit_text
attributes -- run length encoded attributes for text
insert_text(self, text)
Insert text at the cursor position and update cursor.
keypress(self, (maxcol,), key)
Handle editing keystrokes, return others.
mouse_event(self, (maxcol,), event, button, x, y, focus)
Move the cursor to the location clicked for button 1.
move_cursor_to_coords(self, (maxcol,), x, y)
Set the cursor position with (x,y) coordinates.
 
Returns True if move succeeded, False otherwise.
position_coords(self, maxcol, pos)
Return (x,y) coordinates for an offset into self.edit_text.
render = cached_render(self, size, focus=False)
selectable(self)
set_caption(self, caption)
Set the caption markup for this widget.
set_edit_pos(self, pos)
Set the cursor position with a self.edit_text offset.
set_edit_text(self, text)
Set the edit text for this widget.
update_text(self)
Deprecated.  Use set_caption and/or set_edit_text instead.
 
Make sure any cached line translation is not reused.
valid_char(self, ch)
Return true for printable characters.

Methods inherited from Text:
pack(self, size=None, focus=False)
Return the number of screen columns required for this Text
widget to be displayed without wrapping or clipping, as a 
single element tuple.
 
size -- None for unlimited screen columns or (maxcol,) to
        specify a maximum column size
rows = cached_rows(self, size, focus=False)
set_align_mode(self, mode)
Set text alignment / justification.  
 
Valid modes for StandardTextLayout are: 
        'left', 'center' and 'right'
set_layout(self, align, wrap, layout=None)
Set layout object, align and wrap modes.
 
align -- align mode for text layout
wrap -- wrap mode for text layout
layout -- layout object to use, defaults to StandardTextLayout
set_text(self, markup)
Set content of text widget.
set_wrap_mode(self, mode)
Set wrap mode.  
 
Valid modes for StandardTextLayout are :
        'any'   : wrap at any character
        'space' : wrap on space character
        'clip'  : truncate lines instead of wrapping

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function IntEdit [back to top]

class IntEdit(Edit) [back to top]

Method resolution order:
IntEdit
Edit
Text
FlowWidget
Widget
object

Methods defined here:
__init__(self, caption='', default=None)
caption -- caption markup
default -- default edit value
keypress(self, (maxcol,), key)
Handle editing keystrokes.  Return others.
valid_char(self, ch)
Return true for decimal digits.
value(self)
Return the numeric value of self.edit_text.

Methods inherited from Edit:
get_cursor_coords(self, (maxcol,))
Return the (x,y) coordinates of cursor within widget.
get_edit_text(self)
Return the edit text for this widget.
get_line_translation(self, maxcol, ta=None)
get_pref_col(self, (maxcol,))
Return the preferred column for the cursor, or the
current cursor x value.
get_text(self)
get_text() -> text, attributes
 
text -- complete text of caption and edit_text
attributes -- run length encoded attributes for text
insert_text(self, text)
Insert text at the cursor position and update cursor.
mouse_event(self, (maxcol,), event, button, x, y, focus)
Move the cursor to the location clicked for button 1.
move_cursor_to_coords(self, (maxcol,), x, y)
Set the cursor position with (x,y) coordinates.
 
Returns True if move succeeded, False otherwise.
position_coords(self, maxcol, pos)
Return (x,y) coordinates for an offset into self.edit_text.
render = cached_render(self, size, focus=False)
selectable(self)
set_caption(self, caption)
Set the caption markup for this widget.
set_edit_pos(self, pos)
Set the cursor position with a self.edit_text offset.
set_edit_text(self, text)
Set the edit text for this widget.
update_text(self)
Deprecated.  Use set_caption and/or set_edit_text instead.
 
Make sure any cached line translation is not reused.

Methods inherited from Text:
pack(self, size=None, focus=False)
Return the number of screen columns required for this Text
widget to be displayed without wrapping or clipping, as a 
single element tuple.
 
size -- None for unlimited screen columns or (maxcol,) to
        specify a maximum column size
rows = cached_rows(self, size, focus=False)
set_align_mode(self, mode)
Set text alignment / justification.  
 
Valid modes for StandardTextLayout are: 
        'left', 'center' and 'right'
set_layout(self, align, wrap, layout=None)
Set layout object, align and wrap modes.
 
align -- align mode for text layout
wrap -- wrap mode for text layout
layout -- layout object to use, defaults to StandardTextLayout
set_text(self, markup)
Set content of text widget.
set_wrap_mode(self, mode)
Set wrap mode.  
 
Valid modes for StandardTextLayout are :
        'any'   : wrap at any character
        'space' : wrap on space character
        'clip'  : truncate lines instead of wrapping

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function Button [back to top]

class Button(WidgetWrap) [back to top]

Method resolution order:
Button
WidgetWrap
Widget
object

Methods defined here:
__init__(self, label, on_press=None, user_data=None)
label -- markup for button label
on_press -- callback function for button "press"
           on_press( button object, user_data=None)
user_data -- additional param for on_press callback,
           ommited if None for compatibility reasons
get_cursor_coords(self, (maxcol,))
Return the location of the cursor.
get_label(self)
keypress(self, (maxcol,), key)
Call on_press on spage or enter.
mouse_event(self, (maxcol,), event, button, x, y, focus)
Call on_press on button 1 press.
render = cached_render(self, size, focus=False)
selectable(self)
set_label(self, label)

Data and other attributes defined here:
button_left = <urwid.widget.Text object at 0x8234aac>
button_right = <urwid.widget.Text object at 0x8234acc>

Methods inherited from WidgetWrap:
__getattr__(self, name)
Call self.w if name is in Widget interface definition.
get_w(self)
set_w(self, w)

Data descriptors inherited from WidgetWrap:
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function CheckBox [back to top]

class CheckBox(WidgetWrap) [back to top]

Method resolution order:
CheckBox
WidgetWrap
Widget
object

Methods defined here:
__init__(self, label, state=False, has_mixed=False, on_state_change=None, user_data=None)
label -- markup for check box label
state -- False, True or "mixed"
has_mixed -- True if "mixed" is a state to cycle through
on_state_change -- callback function for state changes
                   on_state_change( check box, new state,
                                    user_data=None)
user_data -- additional param for on_press callback,
             ommited if None for compatibility reasons
get_label(self)
Return label text.
get_state(self)
Return the state of the checkbox.
keypress(self, (maxcol,), key)
Toggle state on space or enter.
mouse_event(self, (maxcol,), event, button, x, y, focus)
Toggle state on button 1 press.
selectable(self)
set_label(self, label)
Change the check box label.
set_state(self, state, do_callback=True)
Call on_state_change if do_callback is True,
then change the check box state.
toggle_state(self)
Cycle to the next valid state.

Data and other attributes defined here:
reserve_columns = 4
states = {False: <urwid.widget.SelectableIcon object at 0x823494c>, True: <urwid.widget.SelectableIcon object at 0x823492c>, 'mixed': <urwid.widget.SelectableIcon object at 0x82349ac>}

Methods inherited from WidgetWrap:
__getattr__(self, name)
Call self.w if name is in Widget interface definition.
get_w(self)
render = cached_render(self, size, focus=False)
set_w(self, w)

Data descriptors inherited from WidgetWrap:
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function RadioButton [back to top]

class RadioButton(WidgetWrap) [back to top]

Method resolution order:
RadioButton
WidgetWrap
Widget
object

Methods defined here:
__init__(self, group, label, state='first True', on_state_change=None, user_data=None)
group -- list for radio buttons in same group
label -- markup for radio button label
state -- False, True, "mixed" or "first True"
on_state_change -- callback function for state changes
                   on_state_change( radio_button, new_state,
                                    user_data=None)
user_data -- additional param for on_press callback,
             ommited if None for compatibility reasons
 
This function will append the new radio button to group.
"first True" will set to True if group is empty.
get_label(self)
Return label text.
get_state(self)
Return the state of the radio button.
keypress(self, (maxcol,), key)
Set state to True on space or enter.
mouse_event(self, (maxcol,), event, button, x, y, focus)
Set state to True on button 1 press.
selectable(self)
set_label(self, label)
Change the check box label.
set_state(self, state, do_callback=True)
Call on_state_change if do_callback is True,
then change the radio button state.
if state is True set all other radio buttons in group to False.

Data and other attributes defined here:
reserve_columns = 4
states = {False: <urwid.widget.SelectableIcon object at 0x8234a0c>, True: <urwid.widget.SelectableIcon object at 0x82349ec>, 'mixed': <urwid.widget.SelectableIcon object at 0x8234a6c>}

Methods inherited from WidgetWrap:
__getattr__(self, name)
Call self.w if name is in Widget interface definition.
get_w(self)
render = cached_render(self, size, focus=False)
set_w(self, w)

Data descriptors inherited from WidgetWrap:
w

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

Graphics

function BarGraph [back to top]

class BarGraph(BoxWidget) [back to top]

Method resolution order:
BarGraph
BoxWidget
Widget
object

Methods defined here:
__init__(self, attlist, hatt=None, satt=None)
Create a bar graph with the passed display characteristics.
see set_segment_attributes for a description of the parameters.
calculate_bar_widths(self, (maxcol, maxrow), bardata)
Return a list of bar widths, one for each bar in data.
 
If self.bar_width is None this implementation will stretch 
the bars across the available space specified by maxcol.
calculate_display(self, (maxcol, maxrow))
Calculate display data.
hlines_display(self, disp, top, hlines, maxrow)
Add hlines to display structure represented as bar_type tuple
values:
(bg, 0-5)
bg is the segment that has the hline on it
0-5 is the hline graphic to use where 0 is a regular underscore
and 1-5 are the UTF-8 horizontal scan line characters.
render = cached_render(self, size, focus=False)
selectable(self)
Return False.
set_bar_width(self, width)
Set a preferred bar width for calculate_bar_widths to use.
 
width -- width of bar or None for automatic width adjustment
set_data(self, bardata, top, hlines=None)
Store bar data, bargraph top and horizontal line positions.
 
bardata -- a list of bar values.
top -- maximum value for segments within bardata
hlines -- None or a bar value marking horizontal line positions
 
bar values are [ segment1, segment2, ... ] lists where top is 
the maximal value corresponding to the top of the bar graph and
segment1, segment2, ... are the values for the top of each 
segment of this bar.  Simple bar graphs will only have one
segment in each bar value.
 
Eg: if top is 100 and there is a bar value of [ 80, 30 ] then
the top of this bar will be at 80% of full height of the graph
and it will have a second segment that starts at 30%.
set_segment_attributes(self, attlist, hatt=None, satt=None)
attlist -- list containing attribute or (attribute, character)
        tuple for background, first segment, and optionally
        following segments. ie. len(attlist) == num segments+1
        character defaults to ' ' if not specified.
hatt -- list containing attributes for horizontal lines. First 
        lement is for lines on background, second is for lines
        on first segment, third is for lines on second segment
        etc..
satt -- dictionary containing attributes for smoothed 
        transitions of bars in UTF-8 display mode. The values
        are in the form:
                (fg,bg) : attr
        fg and bg are integers where 0 is the graph background,
        1 is the first segment, 2 is the second, ...  
        fg > bg in all values.  attr is an attribute with a 
        foreground corresponding to fg and a background 
        corresponding to bg.
        
If satt is not None and the bar graph is being displayed in
a terminal using the UTF-8 encoding then the character cell
that is shared between the segments specified will be smoothed
with using the UTF-8 vertical eighth characters.
 
eg: set_segment_attributes( ['no', ('unsure',"?"), 'yes'] )
will use the attribute 'no' for the background (the area from
the top of the graph to the top of the bar), question marks 
with the attribute 'unsure' will be used for the topmost 
segment of the bar, and the attribute 'yes' will be used for
the bottom segment of the bar.
smooth_display(self, disp)
smooth (col, row*8) display into (col, row) display using
UTF vertical eighth characters represented as bar_type
tuple values:
( fg, bg, 1-7 )
where fg is the lower segment, bg is the upper segment and
1-7 is the vertical eighth character to use.
use_smoothed(self)

Data descriptors defined here:
get_data

Data and other attributes defined here:
__metaclass__ = <class 'urwid.graphics.BarGraphMeta'>
Detect subclass get_data() method and dynamic change to
get_data() method and disable caching in these cases.
 
This is for backwards compatibility only, new programs
should use set_data() instead of overriding get_data().
eighths = u' \u2581\u2582\u2583\u2584\u2585\u2586\u2587'
hlines = u'_\u23ba\u23bb\u2500\u23bc\u23bd'

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

function GraphVScale [back to top]

class GraphVScale(BoxWidget) [back to top]

Method resolution order:
GraphVScale
BoxWidget
Widget
object

Methods defined here:
__init__(self, labels, top)
GraphVScale( [(label1 position, label1 markup),...], top )
label position -- 0 < position < top for the y position
label markup -- text markup for this label
top -- top y position
 
This widget is a vertical scale for the BarGraph widget that
can correspond to the BarGraph's horizontal lines
render = cached_render(self, size, focus=False)
selectable(self)
Return False.
set_scale(self, labels, top)
set_scale( [(label1 position, label1 markup),...], top )
label position -- 0 < position < top for the y position
label markup -- text markup for this label
top -- top y position

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function ProgressBar [back to top]

class ProgressBar(FlowWidget) [back to top]

Method resolution order:
ProgressBar
FlowWidget
Widget
object

Methods defined here:
__init__(self, normal, complete, current=0, done=100, satt=None)
normal -- attribute for uncomplete part of progress bar
complete -- attribute for complete part of progress bar
current -- current progress
done -- progress amount at 100%
satt -- attribute for smoothed part of bar where the foreground
        of satt corresponds to the normal part and the
        background corresponds to the complete part.  If satt
        is None then no smoothing will be done.
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)
set_completion(self, current)
current -- current progress

Data and other attributes defined here:
eighths = u' \u258f\u258e\u258d\u258c\u258b\u258a\u2589'

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function BigText [back to top]

class BigText(FixedWidget) [back to top]

Method resolution order:
BigText
FixedWidget
Widget
object

Methods defined here:
__init__(self, markup, font)
markup -- same as Text widget markup
font -- instance of a Font class
get_text(self)
Returns (text, attributes).
pack(self, size=None, focus=False)
render = cached_render(self, size, focus=False)
set_font(self, font)
set_text(self, markup)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function get_all_fonts [back to top]

get_all_fonts()
Return a list of (font name, font class) tuples.

Abstract widgets & interfaces

Widget interface definition [back to top]

Methods defined here:
get_cursor_coords(self, size)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the widget when rendered
        
Returns (col,row) coordinates for cursor or None if no cursor.
 
MUST be implemented if render function returns a canvas with
a cursor.  
MUST match the cursor in the canvas returned by render function
when focus=True.
Caller MUST treat no implementation as equivalent to an 
implementation that always returns None.
get_pref_col(self, size)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the widget when rendered
        
Returns the preferred screen column as an integer or None.
 
Caller MUST treat no implementation as equivalent to an 
implementation that always returns None.
keypress(self, size, key)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the widget when rendered
key -- key pressed
 
Returns None if key was handled, returns key if not handled.
 
MUST be implemented if selectable function returns True.
MUST NOT be called if selectable function returns False.
mouse_event(self, size, event, button, col, row, focus)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the widget when rendered
event -- event part of mouse event structure, eg. 'press',
         'release', 'drag', 'meta press' etc..
button -- button number for event between 1 and 5, may be 0
          on button release events if button is unknown
col -- screen column of event, relative to left edge of widget
row -- screen row of event, relative to top edge of widget
focus -- True if this widget is in focus
 
Returns True if event was handled, False otherwise.
 
Caller MUST treat no implementation as equivalent to an
implementation that always returns False.
move_cursor_to_coords(self, size, col, row)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the widget when rendered
col -- desired screen column for cursor to appear, relative
       to left edge of widget
row -- desired screen row for cursor to appear, relative to
       top edge of widget
        
Returns True on success, False on failure.
 
MUST succeed if there is any column on passed row that the
cursor may be moved to.
Caller MUST treat no implementation as equivalent to an
implementation that always returns True.
render(self, size, focus=False)
size -- flow widgets: (maxcol,)  box widgets: (maxcol,maxrow)
        where maxcol and maxrow are the maximum screen columns
        and rows for the canvas returned
focus -- True if this widget is in focus
 
Returns a canvas object.
 
MUST be implemented.
MUST NOT return a canvas with a cursor when focus=False.
rows(self, (maxcol,), focus=False)
maxcol -- maximum screen columns for rendered widget
focus -- True if this widget is in focus
 
Returns an integer number or screen rows required.
 
MUST be implemented by all flow widgets.
MUST match the number of rows in the canvas returned by
render function called with the same parameters.
selectable(self)
Returns True if this widget will accept keyboard input and
should take the focus when changing focus between widgets.
 
MUST be implemented.

function Widget [back to top]

class Widget(object) [back to top]

Methods defined here:
selectable(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function BoxWidget [back to top]

class BoxWidget(Widget) [back to top]

Method resolution order:
BoxWidget
Widget
object

Methods defined here:
render = cached_render(self, size, focus=False)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function FlowWidget [back to top]

class FlowWidget(Widget) [back to top]

Method resolution order:
FlowWidget
Widget
object

Methods defined here:
render = cached_render(self, size, focus=False)
rows = cached_rows(self, size, focus=False)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

function FixedWidget [back to top]

class FixedWidget(Widget) [back to top]

Method resolution order:
FixedWidget
Widget
object

Methods defined here:
pack(self, size=None, focus=False)
All fixed widgets must implement this function.
render = cached_render(self, size, focus=False)

Methods inherited from Widget:
selectable(self)

Data descriptors inherited from Widget:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Widget:
__metaclass__ = <class 'urwid.widget.WidgetMeta'>
Automatic caching of render and rows methods.
 
Class variable no_cache is a list of names of methods to not cache.
Class variable ignore_focus if defined and True indicates that this
widget is not affected by the focus parameter, so it may be ignored
when caching.

List Walker interface definition [back to top]

Methods defined here:
get_focus(self)
Returns (widget, position).
 
MUST be implemented.
Caller MUST NOT assume that position object may be stored and
reused after contents of list change.
get_next(self, position)
position -- a position returned by get_focus or get_next
 
Returns (widget below, position below).
 
MUST be implemented.
Caller MUST NOT assume that position object may be stored and
reused after contents of list change.
get_prev(self, position)
position -- a position returned by get_focus or get_prev
 
Returns (widget above, position above).
 
MUST be implemented.
Caller MUST NOT assume that position object may be stored and
reused after contents of list change.
set_focus(self, position)
position -- a position returned by get_focus, get_next or
            get_prev
 
Returns None.
 
MUST be implemented.  Should send "modified" signal (or call
self._modified if inheriting from ListWalker)

function ListWalker [back to top]

class ListWalker(object) [back to top]

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__metaclass__ = <class 'urwid.util.MetaSignals'>
register the list of signals in the class varable signals,
including signals in superclasses.
signals = ['modified']

ListBox list walkers

function PollingListWalker [back to top]

class PollingListWalker(object) [back to top]

Methods defined here:
__init__(self, contents)
contents -- list to poll for changes
get_focus(self)
Return (focus widget, focus position).
get_next(self, start_from)
Return (widget after start_from, position after start_from).
get_prev(self, start_from)
Return (widget before start_from, position before start_from).
set_focus(self, position)
Set focus position.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

function SimpleListWalker [back to top]

class SimpleListWalker(MonitoredList, ListWalker) [back to top]

Method resolution order:
SimpleListWalker
MonitoredList
UserList
ListWalker
object

Methods defined here:
__init__(self, contents)
contents -- list to copy into this object
 
Changes made to this object (when it is treated as a list) are
detected automatically and will cause ListBox objects using
this list walker to be updated.
get_focus(self)
Return (focus widget, focus position).
get_next(self, start_from)
Return (widget after start_from, position after start_from).
get_prev(self, start_from)
Return (widget before start_from, position before start_from).
set_focus(self, position)
Set focus position.
set_modified_callback(self, callback)
This function inherited from MonitoredList is not 
implemented in SimleListWalker.
 
Use Signals.connect(list_walker, "modified", ...) instead.

Data descriptors defined here:
contents
Return self.
 
Provides compatibility with old SimpleListWalker class.

Methods inherited from MonitoredList:
__add__ = call_modified_wrapper(self, *args)
__delitem__ = call_modified_wrapper(self, *args)
__delslice__ = call_modified_wrapper(self, *args)
__iadd__ = call_modified_wrapper(self, *args)
__imul__ = call_modified_wrapper(self, *args)
__repr__(self)
__rmul__ = call_modified_wrapper(self, *args)
__setitem__ = call_modified_wrapper(self, *args)
__setslice__ = call_modified_wrapper(self, *args)
append = call_modified_wrapper(self, *args)
extend = call_modified_wrapper(self, *args)
insert = call_modified_wrapper(self, *args)
pop = call_modified_wrapper(self, *args)
remove = call_modified_wrapper(self, *args)
reverse = call_modified_wrapper(self, *args)
sort = call_modified_wrapper(self, *args)

Methods inherited from UserList:
__cmp__(self, other)
__contains__(self, item)
__eq__(self, other)
__ge__(self, other)
__getitem__(self, i)
__getslice__(self, i, j)
__gt__(self, other)
__le__(self, other)
__len__(self)
__lt__(self, other)
__mul__(self, n)
__ne__(self, other)
__radd__(self, other)
count(self, item)
index(self, item, *args)

Data descriptors inherited from ListWalker:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from ListWalker:
__metaclass__ = <class 'urwid.util.MetaSignals'>
register the list of signals in the class varable signals,
including signals in superclasses.
signals = ['modified']

Canvas painting

function Canvas [back to top]

class Canvas(object) [back to top]

Methods defined here:
__init__(self, value1=None, value2=None, value3=None)
value1, value2, value3 -- if not None, raise a helpful error:
        the old Canvas class is now called TextCanvas.
cols(self)
content(self, trim_left=0, trim_top=0, cols=None, rows=None, attr=None)
content_delta(self)
finalize(self, widget, size, focus)
Mark this canvas as finalized (should not be any future
changes to its content). This is required before caching
the canvas.  This happens automatically after a widget's
render call returns the canvas thanks to some metaclass
magic.
 
widget -- widget that rendered this canvas
size -- size parameter passed to widget's render method
focus -- focus parameter passed to widget's render method
get_cursor(self)
rows(self)
set_cursor(self, c)
translate_coords(self, dx, dy)
Return coords shifted by (dx, dy).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
attr
cs
cursor
text
widget_info

function TextCanvas [back to top]

class TextCanvas(Canvas) [back to top]

Method resolution order:
TextCanvas
Canvas
object

Methods defined here:
__init__(self, text=None, attr=None, cs=None, cursor=None, maxcol=None, check_width=True)
text -- list of strings, one for each line
attr -- list of run length encoded attributes for text
cs -- list of run length encoded character set for text
cursor -- (x,y) of cursor or None
maxcol -- screen columns taken by this canvas
check_width -- check and fix width of all lines in text
cols(self)
Return the screen column width of this canvas.
content(self, trim_left=0, trim_top=0, cols=None, rows=None, def_attr=None)
Return the canvas content as a list of rows where each row
is a list of (attr, cs, text) tuples.
 
trim_left, trim_top, cols, rows may be set by 
CompositeCanvas when rendering a partially obscured
canvas.
content_delta(self, other)
Return the differences between other and this canvas.
 
If other is the same object as self this will return no 
differences, otherwise this is the same as calling 
content().
rows(self)
Return the number of rows in this canvas.
translated_coords(self, dx, dy)
Return cursor coords shifted by (dx, dy), or None if there
is no cursor.

Methods inherited from Canvas:
finalize(self, widget, size, focus)
Mark this canvas as finalized (should not be any future
changes to its content). This is required before caching
the canvas.  This happens automatically after a widget's
render call returns the canvas thanks to some metaclass
magic.
 
widget -- widget that rendered this canvas
size -- size parameter passed to widget's render method
focus -- focus parameter passed to widget's render method
get_cursor(self)
set_cursor(self, c)
translate_coords(self, dx, dy)
Return coords shifted by (dx, dy).

Data descriptors inherited from Canvas:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
attr
cs
cursor
text
widget_info

function CompositeCanvas [back to top]

class CompositeCanvas(Canvas) [back to top]

Method resolution order:
CompositeCanvas
Canvas
object

Methods defined here:
__init__(self, canv=None)
canv -- a Canvas object to wrap this CompositeCanvas around.
 
if canv is a CompositeCanvas, make a copy of its contents
cols(self)
content(self)
Return the canvas content as a list of rows where each row
is a list of (attr, cs, text) tuples.
content_delta(self, other)
Return the differences between other and this canvas.
fill_attr(self, a)
Apply attribute a to all areas of this canvas with default
attribute currently set to None, leaving other attributes
intact.
overlay(self, other, left, top)
Overlay other onto this canvas.
pad_trim_left_right(self, left, right)
Pad or trim this canvas on the left and right
 
values > 0 indicate screen columns to pad
values < 0 indicate screen columns to trim
pad_trim_top_bottom(self, top, bottom)
Pad or trim this canvas on the top and bottom.
rows(self)
set_depends(self, widget_list)
Explicitly specify the list of widgets that this canvas
depends on.  If any of these widgets change this canvas
will have to be updated.
trim(self, top, count=None)
Trim lines from the top and/or bottom of canvas.
 
top -- number of lines to remove from top
count -- number of lines to keep, or None for all the rest
trim_end(self, end)
Trim lines from the bottom of the canvas.
 
end -- number of lines to remove from the end

Methods inherited from Canvas:
finalize(self, widget, size, focus)
Mark this canvas as finalized (should not be any future
changes to its content). This is required before caching
the canvas.  This happens automatically after a widget's
render call returns the canvas thanks to some metaclass
magic.
 
widget -- widget that rendered this canvas
size -- size parameter passed to widget's render method
focus -- focus parameter passed to widget's render method
get_cursor(self)
set_cursor(self, c)
translate_coords(self, dx, dy)
Return coords shifted by (dx, dy).

Data descriptors inherited from Canvas:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
attr
cs
cursor
text
widget_info

function SolidCanvas [back to top]

class SolidCanvas(Canvas) [back to top]

Method resolution order:
SolidCanvas
Canvas
object

Methods defined here:
__init__(self, fill_char, cols, rows)
cols(self)
content(self, trim_left=0, trim_top=0, cols=None, rows=None, attr=None)
content_delta(self, other)
Return the differences between other and this canvas.
rows(self)

Methods inherited from Canvas:
finalize(self, widget, size, focus)
Mark this canvas as finalized (should not be any future
changes to its content). This is required before caching
the canvas.  This happens automatically after a widget's
render call returns the canvas thanks to some metaclass
magic.
 
widget -- widget that rendered this canvas
size -- size parameter passed to widget's render method
focus -- focus parameter passed to widget's render method
get_cursor(self)
set_cursor(self, c)
translate_coords(self, dx, dy)
Return coords shifted by (dx, dy).

Data descriptors inherited from Canvas:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
attr
cs
cursor
text
widget_info

function CanvasCombine [back to top]

CanvasCombine(l)
Stack canvases in l vertically and return resulting canvas.
 
l -- list of (canvas, position, focus) tuples.  position is a value
     that widget.set_focus will accept, or None if not allowed.
     focus is True if this canvas is the one that would be in focus
     if the whole widget is in focus.

function CanvasJoin [back to top]

CanvasJoin(l)
Join canvases in l horizontally. Return result.
l -- list of (canvas, position, focus, cols) tuples.  position is a 
     value that widget.set_focus will accept,  or None if not allowed.
     focus is True if this canvas is the one that would be in focus if
     the whole widget is in focus.  cols is the number of screen
     columns that this widget will require, if larger than the actual
     canvas.cols() value then this widget will be padded on the right.

function CanvasOverlay [back to top]

CanvasOverlay(top_c, bottom_c, left, top)
Overlay canvas top_c onto bottom_c at position (left, top).

Custom formatting rules

class TextLayout [back to top]

Methods defined here:
layout(self, text, width, align, wrap)
Return a layout structure for text.
 
text -- string in current encoding or unicode string
width -- number of screen columns available
align -- align mode for text
wrap -- wrap mode for text
 
Layout structure is a list of line layouts, one per output line.
Line layouts are lists than may contain the following tuples:
  ( column width of text segment, start offset, end offset )
  ( number of space characters to insert, offset or None)
  ( column width of insert text, offset, "insert text" )
 
The offset in the last two tuples is used to determine the
attribute used for the inserted spaces or text respectively.  
The attribute used will be the same as the attribute at that 
text offset.  If the offset is None when inserting spaces
then no attribute will be used.
supports_align_mode(self, align)
Return True if align is a supported align mode.
supports_wrap_mode(self, wrap)
Return True if wrap is a supported wrap mode.

class StandardTextLayout(TextLayout) [back to top]

Methods defined here:
__init__(self)
align_layout(self, text, width, segs, wrap, align)
Convert the layout segs to an aligned layout.
calculate_text_segments(self, text, width, wrap)
Calculate the segments of text to display given width screen 
columns to display them.  
 
text - text to display
width - number of available screen columns
wrap - wrapping mode used
 
Returns a layout structure without aligmnent applied.
layout(self, text, width, align, wrap)
Return a layout structure for text.
pack(self, maxcol, layout)
Return a minimal maxcol value that would result in the same
number of lines for layout.  layout must be a layout structure
returned by layout().
supports_align_mode(self, align)
Return True if align is 'left', 'center' or 'right'.
supports_wrap_mode(self, wrap)
Return True if wrap is 'any', 'space' or 'clip'.

Character encoding

function set_encoding [back to top]

set_encoding(encoding)
Set the byte encoding to assume when processing strings and the
encoding to use when converting unicode strings.

function get_encoding_mode [back to top]

get_encoding_mode()
Get the mode Urwid is using when processing text strings.
Returns 'narrow' for 8-bit encodings, 'wide' for CJK encodings
or 'utf8' for UTF-8 encodings.

function supports_unicode [back to top]

supports_unicode()
Return True if python is able to convert non-ascii unicode strings
to the current encoding.

Screen capture

function html_fragment.screenshot_init [back to top]

html_fragment.screenshot_init = screenshot_init(sizes, keys)
Replace curses_display.Screen and raw_display.Screen class with 
HtmlGenerator.
 
Call this function before executing an application that uses 
curses_display.Screen to have that code use HtmlGenerator instead.
 
sizes -- list of ( columns, rows ) tuples to be returned by each call
         to HtmlGenerator.get_cols_rows()
keys -- list of lists of keys to be returned by each call to
        HtmlGenerator.get_input()
 
Lists of keys may include "window resize" to force the application to
call get_cols_rows and read a new screen size.
 
For example, the following call will prepare an application to:
 1. start in 80x25 with its first call to get_cols_rows()
 2. take a screenshot when it calls draw_screen(..)
 3. simulate 5 "down" keys from get_input()
 4. take a screenshot when it calls draw_screen(..)
 5. simulate keys "a", "b", "c" and a "window resize"
 6. resize to 20x10 on its second call to get_cols_rows()
 7. take a screenshot when it calls draw_screen(..)
 8. simulate a "Q" keypress to quit the application
 
screenshot_init( [ (80,25), (20,10) ],
        [ ["down"]*5, ["a","b","c","window resize"], ["Q"] ] )

function html_fragment.screenshot_collect [back to top]

html_fragment.screenshot_collect = screenshot_collect()
Return screenshots as a list of HTML fragments.

html_fragment.HtmlGenerator [back to top]

Methods defined here:
__init__(self)
clear(self)
Force the screen to be completely repainted on the next
call to draw_screen().
 
(does nothing for html_fragment)
draw_screen(self, (cols, rows), r)
Create an html fragment from the render object. 
Append it to HtmlGenerator.fragments list.
get_cols_rows(self)
Return the next screen size in HtmlGenerator.sizes.
get_input(self)
Return the next list of keypresses in HtmlGenerator.keys.
register_palette(self, l)
Register a list of palette entries.
 
l -- list of (name, foreground, background) or
     (name, same_as_other_name) palette entries.
 
calls self.register_palette_entry for each item in l
register_palette_entry(self, name, foreground, background, mono=None)
Register a single palette entry.
 
name -- new entry/attribute name
foreground -- foreground colour
background -- background colour
mono -- monochrome terminal attribute
 
See curses_display.register_palette_entry for more info.
run_wrapper(self, fn)
Call fn.
set_mouse_tracking(self)
Not yet implemented
start(self)
stop(self)

Data and other attributes defined here:
fragments = []
keys = []
sizes = []

Web Application Interface

function web_display.is_web_request [back to top]

web_display.is_web_request = is_web_request()
Return True if this is a CGI web request.

function web_display.set_preferences [back to top]

web_display.set_preferences = set_preferences(app_name, pipe_dir='/tmp', allow_polling=True, max_clients=20)
Set web_display preferences.
 
app_name -- application name to appear in html interface
pipe_dir -- directory for input pipes, daemon update sockets 
            and daemon error logs
allow_polling -- allow creation of daemon processes for 
                 browsers without multipart support 
max_clients -- maximum concurrent client connections. This
               pool is shared by all urwid applications
               using the same pipe_dir

function web_display.handle_short_request [back to top]

web_display.handle_short_request = handle_short_request()
Handle short requests such as passing keystrokes to the application
or sending the initial html page.  If returns True, then this
function recognised and handled a short request, and the calling
script should immediately exit.
 
web_display.set_preferences(..) should be called before calling this
function for the preferences to take effect