On Tuesday 30 December 2008 08:39:51 pm Christopher Barker wrote:
> Aki Koskinen wrote:
> > Hi there.
>
> I've cc'd this note to the floatcanvas list -- I like to keep
> correspondence on that list, as it creates an archive, and others can
> chime in. I hope you will join the list.
I did. So now I'm here:)
> > R = Canvas.AddRectangle((x,y), (w, h))
> > T = Canvas.AddText("Text", (x, y))
> > G = Canvas.AddGroup()
> > G.AddObject(self.R)
> > G.AddObject(self.T)
>
> You probably don't want to do it that way -- that will put draw each of
> those objects twice -- once by itself, and once as part of the group.
> You want:
>
> R = FloatCanvas.Rectangle((x,y), (w, h))
> T = FloatCanvas.Text("Text", (x, y))
> G = Canvas.AddGroup()
> G.AddObject(self.R)
> G.AddObject(self.T)
I thought I tried that at first but if I remember correctly I got some other
exception. However now that I changed my test code like your example it works
fine.
I have a dim picture about it being something about a member called _canvas.
And now that I searched through the FloatCanvas source I saw _Canvas in the
Bind method of DrawObject. And it might be that previously I was doing
something like this:
R = FloatCanvas.Rectangle((x,y), (w, h))
R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, someHandler)
...and got an exception in the Bind method about _Canvas being None. But this
is just guessing as I'm not getting that exception any more :)
> > I think the AddObject should be something like:
> >
> > def AddObject(self, obj):
> > self.ObjectList.append(obj)
> > if self.BoundingBox != None:
> > self.BoundingBox.Merge(obj.BoundingBox)
> > else:
> > self.BoundingBox = obj.BoundingBox
>
> hmm. I wonder if that's the best approach, or if I should create a Null
> bounding box object....
Maybe I went ahead of myself telling how things should be done. After all I
have only a couple of days of FloatCanvas experience... Off course the ones
that know better should figure out the final solution.
--
Aki Koskinen
http://www.akikoskinen.info/
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas