# Deprecated Classes

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

  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

  This widget is a special case of the new AttrMap widget, and it will pass all function calls and variable references to the wrapped widget. This class is maintained for backwards compatibility only, new code should use AttrMap instead.

      >>> 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   ')]

  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 wapped 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]
    Returns:

      A frozenset including one or more of `'box'`, `'flow'` and `'fixed'`. Default implementation returns the value of `_sizing`, which for this class includes all three.

    The sizing modes returned indicate the modes that may be supported by this widget, but is not sufficient to know that using that sizing mode will work. Subclasses should make an effort to remove sizing modes they know will not work given the state of the widget, but many do not yet do this.

    If a sizing mode is missing from the set then the widget should fail when used in that mode.

    If `'flow'` is among the values returned then the other methods in this widget must be able to accept a single-element tuple (maxcol,) to their `size` parameter, and the `rows()` method must be defined.

    If `'box'` is among the values returned then the other methods must be able to accept a two-element tuple (maxcol, maxrow) to their size parameter.

    If `'fixed'` is among the values returned then the other methods must be able to accept an empty tuple () to their size parameter, and the `pack()` method must be defined.

  property w: Widget

    backwards compatibility, widget used to be stored as w

class urwid.MetaSuper

  Deprecated metaclass.

  Present only for code compatibility, all logic has been removed. Please move to the last position in the class bases to allow future changes.