[reportlab-users] Graphics: One shape instance can be drawn at multiple positions ?

Robin Becker robin at reportlab.com
Fri Jan 6 03:40:52 EST 2006


nrmj wrote:
> I am reading the "Graphics Guide" and there is
> something I don't understand.
> In chapter 2.6 "Naming Children", there is written:
> 
>    Note that you can use the same shape instance in
> several contexts in a drawing;
>    if you choose to use the same Circle object in many
> locations (e.g. a scatter plot)
>    and use different names to access it,
>    it will still be a shared object and the changes
> will be global.
> 
> I suppose it means that you can create only ONE
> instance of a Circle and draw it at MANY X-Y
> positions, provided that you give a different name to
> each point.
> But how can ONE instance have multiple "x" and "y"
> attributes ?
> 
> Someone can help me understand ?
> 
> Best regards
> 
...... I think you should regard that as a flawed statement. It's true 
that at the renderer level it's possible to reuse a primitive object 
sequence, but at the level of the draw method for a widget there's 
almost no reasonable way to do that. One can reuse widgets, but as you 
suspect it needs care. Suppose you had a collection of primitives with 
fixed relative positions then it might be possible to include the 
collection in more than one Group and have things work as expected. 
Angels only may tread that way :)
-- 
Robin Becker



More information about the reportlab-users mailing list