[pygtk] Deriving new classes from CanvasItem or CanvasGroup

Suresh Jeevanandam jm.suresh at gmail.com
Fri Dec 1 02:01:59 WST 2006


Steve, thanks for the response.

I had missed that part of calling parent's __init__ function.
With this call, now, I am able to add the custom canvas group into the
canvas.root() . However, canvas.root().add(MyNewItem, x=3D0, y=3D0) works f=
ine,
but returns an instance of gnomecanvas.CanvasGroup rather than my new type.
I have a set of methods defined on that class which I am not able to call.

Any pointer to some example code related to this would be of much help to
me. Thanks.

--
Suresh


On 11/30/06, Steve McClure <sMcClure at racemi.com> wrote:
>
> On Thu, 2006-11-30 at 17:24 +0530, Suresh Jeevanandam wrote:
> > Hi,
> >  Is it possible to derive new classes from the CanvasItem or
> > CanvasGroup classes. I tried doing :
> >
> > class MyNewItem(gnomecanvas.CanvasGroup):
> >    def __init__(self):
>
>         # did you call? Probably so but your description is
>         # a little vague.
>         gnomecanvas.CanvasGroup.__init__(self, rest of args)
>
> >       # I add a number of items to self
> >
> > But this does not work when I try to add this custom item into the
> > canvas. Is there any other way I should follow?
> >
> > thanks.
> > --
> > Suresh
> > _______________________________________________
> > pygtk mailing list   pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> --
> Steve McClure                                   Racemi
> email: smcclure at racemi.com                      380 Interstate North Pkwy,
> SE
> voice: 404-892-5850                             Suite 250
> fax: 404-892-7215                               Atlanta, GA 30339
>                                                 http://www.racemi.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061130/76789345/at=
tachment.htm


More information about the pygtk mailing list