Re: goocanvas.Table: expand /align problems



On Tue, 2009-09-22 at 09:23 +0200, Alessandro Dentella wrote:
> Hi,
> 
>   can someone tell me what's wrong with the code below?
>   I dont't seem to understand align and fill for a table layout
> 
> 
> > But it behaves differently from what I'd expect. I'd like to have a
> > rectangle to expand to all the space it has the cell:
> 
>   import gtk
>   import goocanvas
> 
>   window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> 
>   canvas = goocanvas.Canvas()
>   window.add (canvas)
> 
>   root = canvas.get_root_item()
>   table = goocanvas.Table(parent=root)
> 
>   text = goocanvas.Text(parent=table, text="simple text")
>   table.set_child_properties(text, row = 0, column = 0,)
> 
>   rect = goocanvas.Rect(parent=table, height=20, fill_color="red")
>   table.set_child_properties(rect, row = 1, column = 0, 
>                                    x_fill=True, x_expand=True, x_align=1)
> 
> 
> but what  I see is that:
> 
>     1. the rectangle doesn't expand
>     2. the align is at the beginnning of the cell (ignoring x_align=1)
> 
> am I wrong? Should the rectangle (to which I have not set a width) expand?

The basic canvas items don't expand in a table. That isn't completely
trivial as items may be rotated etc. so it may not be a simple case of
changing the width & height.

The only item that changes shape at present is GooCanvasText, where the
height changes according to the allocated width in the table.

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]