get_bounds does not behave as documented

Bug #124921 reported by Ethan Glasser-Camp
4
Affects Status Importance Assigned to Milestone
pygoocanvas
Fix Committed
Undecided
Unassigned

Bug Description

The docs say:

goocanvas.Item.get_bounds

    def get_bounds()

Returns: A tuple containing the four coordinates.

But my version of goocanvas.defs says:

(define-method get_bounds
  (of-object "GooCanvasItem")
  (c-name "goo_canvas_item_get_bounds")
  (return-type "none")
  (parameters
    '("GooCanvasBounds*" "bounds")
  )
)

So instead of doing this:

x1, y1, x2, y2 = item.get_bounds()

You have to do this:

b = goocanvas.Bounds()
item.get_bounds(b)
x1, y1, x2, y2 = b.x1, b.y1, b.x2, b.y2

I feel that this is less Pythonic, but if you actually meant for this to happen, then you should update the docs.

Ethan

Revision history for this message
Ethan Glasser-Camp (ethan-glasser-camp) wrote :

I see this is fixed in SVN. Sorry to waste your time!

Ethan

Revision history for this message
Ethan Glasser-Camp (ethan-glasser-camp) wrote :

goocanvas.override in SVN has a fix: http://svn.berlios.de/wsvn/pygoocanvas/trunk/goocanvas.override?op=file&rev=0&sc=1

%%
override goo_canvas_item_get_bounds noargs
static PyObject *
_wrap_goo_canvas_item_get_bounds(PyGObject *self)
{
    PyObject *py_bounds;
    GooCanvasBounds bounds = {0,};

    goo_canvas_item_get_bounds(GOO_CANVAS_ITEM(self->obj), &bounds);

    py_bounds = pygoo_canvas_bounds_new(&bounds);

    return py_bounds;
}

Changed in pygoocanvas:
status: New → Fix Committed
Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

Ethan thanks for the report and sorry for the delay, I'm not getting all the emails from bugs, I don't know why.
I fix that some time ago as you pointed out, does it work for you now?

Revision history for this message
Ethan Glasser-Camp (ethan-glasser-camp) wrote : Re: [Bug 124921] Re: get_bounds does not behave as documented

On 7/12/07, Gian Mario Tagliaretti <email address hidden> wrote:
>
> Ethan thanks for the report and sorry for the delay, I'm not getting all
> the emails from bugs, I don't know why.
> I fix that some time ago as you pointed out, does it work for you now?
>

I'm not running SVN right now, but just working around it using the other
code I posted until a new Debian package arrives. Is the documentation
updated too, so that it mentions that a Bounds object is returned?

Ethan

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

Updated documentation in svn.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.