goocanvas.Widget
Prev | PyGooCanvas Standard Canvas Items Reference | Next

## goocanvas.Widget

goocanvas.Widget — An embedded widget item.

## Synopsis

    class goocanvas.Widget(goocanvas.ItemSimple):
        goocanvas.Widget(properties=None)

## Ancestry

    +-- gobject.GObject
    	+-- goocanvas.ItemSimple
    		+-- goocanvas.Widget

## goocanvas.Widget Properties

"anchor" | Read/Write | How to position the widget relative to the item's x and y coordinate settings. Default value: gtk.ANCHOR_NORTH_WEST
"height" | Read/Write | The height of the widget, or -1 to use its requested height. Default value: -1
"widget" | Read/Write | The widget to place in the canvas.
"width" | Read/Write | The width of the widget, or -1 to use its requested width. Default value: -1
"x" | Read/Write | The x coordinate of the widget. Default value: 0
"y" | Read/Write | he y coordinate of the widget. Default value: 0

## Implemented Interfaces

`goocanvas.Widget` implements `goocanvas.Item`

## Description

`goocanvas.Widget` provides support for placing any GtkWidget in the canvas. Note that there are a number of limitations in the use of GooCanvasWidget: It doesn't support any transformation besides simple translation. This means you can't scale a canvas with a GooCanvasWidget in it. It doesn't support layering, so you can't place other items beneath or above the GooCanvasWidget. It doesn't support rendering of widgets to a given cairo_t, which means you can't output the widget to a pdf or postscript file. It doesn't have a model/view variant like the other standard items, so it can only be used in a simple canvas without a model.

## Constructor

        goocanvas.Widget(properties=None)

`properties`: | A comma separated properties as **kwargs.
Returns: | A new `goocanvas.Widget`

Creates a new canvas widget item.

Here's an example showing how to create an entry widget centered at (100.0, 100.0):

    entry = gtk.Entry()
    ellipse = goocanvas.Widget(parent = root,
                               widget = entry,
                               x = 100,
                               y = 100,
                               width = -1,
                               height = -1,
                               anchor = gtk.ANCHOR_CENTER)

Prev | Up | Next
goocanvas.Table | Home | PyGooCanvas Canvas Item Models Reference