[Urwid] Align buttons to the border of the screen

Oscar oscar at naiandei.net
Sun Jul 28 06:19:32 EDT 2013


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



More information about the Urwid mailing list