开发者

Automatic DrawingArea scaling on resize with (Py)GTK

How can i scale the gtk.DrawingArea on window resize? I'm writing a code that will draw some colors in DrawingArea that will be added to开发者_开发问答 an gtk.Table cell. I just need, that the image will be stretched in all of space of the cell.

sorry for my english. thx


First create the table with homogeneous turned off:

table = gtk.Table(rows=1, columns=1, homogeneous=False)

If homogeneous is not turned off, every table cell will be as wide and tall as your DrawingArea.

To attach the DrawingArea to the table:

  table.attach(child, left_attach, right_attach, top_attach, bottom_attach,
           xoptions=EXPAND|FILL, yoptions=EXPAND|FILL, xpadding=0, ypadding=0)

Leave xoptions and yoptions as EXPAND|FILL to make the DrawingArea expand. If the table is also set to expand, the default when doing toplevelWindow.add(table), then the DrawingArea should automatically resize when the window is.

See this site for more info: pygtk table documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜