Thank you for your detailled answer. Actually it seems that my current method with a Pile subclass is good enought.
If people are using Pile to simulate an empty widget, maybe and EmptyWidget class would be usefull ? What do you think ? I mean we can manage with WidgetPlaceholder or Pile, but this would simplify some use cases... Cheers Goffi On 08/09/2014 15:04, Ian Ward wrote: > On Mon, Sep 8, 2014 at 3:35 AM, Goffi <[email protected]> wrote: >> G'day, >> >> In documentation of WidgetPlaceholder we can read this: >> « This can be useful for making an interface with a number of distinct >> pages or for showing and hiding menu or status bars. » >> >> But I don't exactly see how to do that: we can't use None for >> original_widget, and there is no « invisible » widget. > > When I wrote this I was thinking that you would switch between pages > (a blank page would could be a SolidFill widget or similar) or you > would use it to show a menu by using a Pile or Frame and then hide a > menu by replacing that with just the widget below/frame body. I wasn't > intending this as a way to make a widget hide itself from its parent. > >> So far to (un)hide menus and status bar, I was adding/removing them from >> my containers, so now I wonder if there is not a better method with >> WidgetPlaceholder... >> >> What is the best practice to (un)hide a widget ? > > I know some people have hidden widgets in Piles and ListBox widgets by > replacing them with an empty Pile (which has 0 height). This seems to > work but may not be well tested, and I'm not sure what happens if one > of these widgets gets selected somehow. I'm pretty sure there's > nothing similar for Columns to make a widget disappear. > > But you're asking about menus and status bars. I would use a > WidgetPlaceholder subclass to wrap a widget that may have a menu or > status bar. Add methods that show or hide the bar by swapping > original_widget with a Pile or Overlay that includes the bar you want > to show. If your status or menu bar is for the whole application your > original_widget might be what was your topmost widget before. > > Ian > > _______________________________________________ > Urwid mailing list > [email protected] > http://lists.excess.org/mailman/listinfo/urwid > _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
