Deprecated Classes

class urwid.AttrWrap(w: WrappedWidget, attr: _AttrMapLike, focus_attr: _AttrMapLike = None)

A special case of the AttrMap widget.

Passes all function calls and variable references on to the wrapped widget.

Deprecated since version 0.9.9: Maintained for backwards compatibility only, new code should use AttrMap instead. This API will be removed in version 7.0.

Build the widget from an existing widget and attribute mapping.

Parameters:
  • w – widget to wrap (stored as self.original_widget)

  • attr – attribute to apply to w

  • focus_attr – attribute to apply when in focus, if None use attr

Deprecated since version 0.9.9: Maintained for backwards compatibility only, new code should use AttrMap instead. This API will be removed in version 7.0.

>>> from urwid import Divider, Edit, Text
>>> AttrWrap(Divider("!"), "bright")
<AttrWrap flow widget <Divider flow widget '!'> attr='bright'>
>>> AttrWrap(Edit(), "notfocus", "focus")
<AttrWrap selectable flow widget <Edit selectable flow widget '' edit_pos=0> attr='notfocus' focus_attr='focus'>
>>> size = (5,)
>>> aw = AttrWrap(Text("hi"), "greeting", "fgreet")
>>> next(aw.render(size, focus=False).content())
[('greeting', None, ...'hi   ')]
>>> next(aw.render(size, focus=True).content())
[('fgreet', None, ...'hi   ')]
property attr: Hashable

Return the attribute applied to the wrapped widget.

property focus_attr: Hashable | None

Return the attribute applied to the wrapped widget when it is in focus.

get_attr() → Hashable

Return the attribute applied to the wrapped widget.

get_focus_attr() → Hashable | None

Return the attribute applied to the wrapped widget when it is in focus.

set_attr(attr: Hashable) → None

Set the attribute to apply to the wrapped widget.

>> w = AttrWrap(Divider(“-“), None) >> w.set_attr(‘new_attr’) >> w <AttrWrap flow widget <Divider flow widget ‘-’> attr=’new_attr’>

set_focus_attr(focus_attr: Hashable) → None

Set the attribute to apply to the wrapped widget when it is in focus.

If None this widget will use the attr instead (no change when in focus).

>> w = AttrWrap(Divider(“-“), ‘old’) >> w.set_focus_attr(‘new_attr’) >> w <AttrWrap flow widget <Divider flow widget ‘-’> attr=’old’ focus_attr=’new_attr’> >> w.set_focus_attr(None) >> w <AttrWrap flow widget <Divider flow widget ‘-’> attr=’old’>

sizing() → frozenset[Sizing]

Return the sizing modes supported by the wrapped widget.

urwid.MetaSuper

Alias of type, kept so that class definitions naming it keep importing. Drop it from metaclass= arguments and from base lists; while it is still listed as a base, it has to be the last one. The name will be removed in version 7.0.

Deprecated since version 4.1.7: GLibEventLoop, with no replacement. It will be removed in version 6.0.

Deprecated Modules

Deprecated since version 5.1.0: The LCD display module urwid.display.lcd, with CF635Screen, will be removed in version 6.0, with no replacement.

Deprecated Import Paths

Deprecated since version 2.4.0: The display modules moved into the urwid.display package. The old names will be removed in version 7.0.

Old import

New import

urwid.display_common

urwid.display.common

urwid.raw_display

urwid.display.raw

urwid.curses_display

urwid.display.curses

urwid.escape

urwid.display.escape

Deprecated since version 2.6.0: Names defined in urwid.str_util and reachable as attributes of urwid.util (from urwid.util import ...) have to be imported from urwid instead. The old import path will be removed in version 6.0.

Deprecated Functions, Methods and Names

Deprecated since version 3.0.4: urwid.str_util.get_char_width() and urwid.str_util.get_width(). Use wcwidth.width() instead. They will be removed in version 6.0.

Deprecated since version 4.1.4: urwid.str_util.decode_one_uni() and urwid.str_util.decode_one_right(), with no replacement. They will be removed in version 6.0.

Deprecated since version 4.1.4: Pile.get_item_size(). Use Pile.get_rows_sizes() instead. It will be removed in version 7.0.

Deprecated since version 4.1.8: display.html_fragment.screenshot_init(), which replaces the curses and raw screens in place. Assign a display.html_fragment.HtmlGenerator to the application’s screen instead. It will be removed in version 6.0.

Deprecated since version 5.0.0: The _MOUSE_*_FLAG and _MOUSE_BUTTON_MASK names of urwid.display.escape. Use the members of urwid.display.escape.MouseBit instead. The old names will be removed in version 6.0.

Deprecated Arguments

Deprecated since version 2.2.3: The camelCase keyword arguments of the numeric edit widgets: trimLeadingZeros of urwid.numedit.NumEdit, and preserveSignificance and decimalSeparator of numedit.FloatEdit. Use trim_leading_zeros, preserve_significance and decimal_separator instead. Support will be removed in version 7.0.

Deprecated since version 2.4.0: Passing an object that does not implement the Widget API as a child widget, to WidgetWrap, a decoration widget, or the contents of a container widget. Pass a Widget instead. Support will be removed in version 7.0.

Deprecated since version 4.0.2: Passing a ListBox body that is not a ListWalker but has a get_focus method. Pass a ListWalker, or a sequence of widgets, instead. Support will be removed in version 7.0.

Deprecated since version 4.0.4: Passing a TreeWidget a node that is not a ParentNode but defines get_first_child. Make the node a ParentNode instead. No removal release is decided.

Deprecated since version 5.0.0: Passing reverse to positions() of SimpleListWalker, SimpleFocusListWalker, SimpleDequeWalker and SimpleFocusDequeWalker positionally. Pass it by keyword instead. Support will be removed in version 8.0.

Deprecated Extension Points

Deprecated since version 4.0.10: Overriding get_data() in a BarGraph subclass, or assigning get_data on an instance. Call BarGraph.set_data() instead. Support will be removed in version 7.0.

Deprecated since version 5.0: Defining get_input_nonblocking() in a subclass of display.raw.Screen. Override get_available_raw_input() instead. Support will be removed in version 7.0.