[Urwid] Align buttons to the border of the screen

Oscar oscar at naiandei.net
Mon Jul 29 11:22:05 EDT 2013


Reading the docs I discovered that one of my problems can be solved 
using a "Divider" widget between of the buttons.

Now only remains the other problem: How do I "pack" each button so 
their width is not the maximum width available but the minimum width 
needed to show them OK? I think that what I'm trying to do is convert 
them from "box" widget to "fixed" widget but I cannot find a way to do 
this in the docs.

Thanks!

--
Oscar

El 2013-07-28 12:19, Oscar escribió:
> Hi,
>
> I'm new to urwid but alhough I'm following all examples and trying 
> all
> the widgets of the reference guide, I can't get two buttons aligned 
> to
> the border of the screen. With the following code I get both buttons
> centered on the screen:
>
> import urwid
> palette = [ ('head','yellow','black'),
> 
> ('reversed','standout',''),('hola','white','black'),('gg','black','dark
> cyan')]
>
> helpa=urwid.Button("help_A")
> helpb=urwid.Button("help_B")
>
> everything=urwid.GridFlow((helpa, helpb), 10, 3, 1, "center")
> loop = urwid.MainLoop(urwid.Filler(everything),palette)
> loop.run()
>
> Current 0utput:
>
>
> ┌──────────────────────────────────────────────────────┐
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │              <help_A>   <help_B>>                    │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> └──────────────────────────────────────────────────────┘
>
> Output wanted:
>
> ┌──────────────────────────────────────────────────────┐
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> │ <help_A>                                   <help_B>> │
> │                                                      │
> │                                                      │
> │                                                      │
> │                                                      │
> └──────────────────────────────────────────────────────┘
>
> Thanks in advance!
>
> --
> Oscar
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid



More information about the Urwid mailing list