[reportlab-users] flowables side by side

Robin Becker reportlab-users@reportlab.com
Sat, 12 Apr 2003 15:47:03 +0100


In article <NFBBIPHPCPOCKHNJJPBICEFFDBAA.fheredero@topmusic.ch>,
François Heredero - Top Music SA <fheredero@topmusic.ch> writes
>> > I want to write these flowables side by side untils they fill
>> > all the with of my frame like :

You can't have Flowables in columns/rows of unknown width. The problem
is that as the width is unknown we must ask the wrap method to get a
size from the object, but we need a max width/height to pass into the
wrap method which is exactly what we don't have.

We could split Flowables into those with/without fixed dimensions and
those without which would allow packers like tables to proceed.
Alternatively we could have a much more general algorithm and attempt a
multi-pass strategy.

I think the easiest option is the first. So let's think of having some
functions that are present when a Flowable has fixed height/width/size
>> > ---------------------
>> > | ***** ***** ***** |
>> > | *CD1* *CD2* *CD3* |
>> > | ***** ***** ***** |
>> > | ***** ***** ***** |
>> > | *CD4* *CD5* *CD6* |
>> > | ***** ***** ***** |
>> > | ***** ***** ***** |
>> > | *CD7* *CD8* *CD9* |
>> > | ***** ***** ***** |
>> > ---------------------
>> Have you tried tables?!
>
>I've tried, but with this flowables
>class FlowCircle(Flowable):
>       def __init__(self):
>               self.size = 4 * mm
>       def wrap(self, *args):
>               return (0, self.size*2)
>       def draw(self):
>               canvas = self.canv
>               canvas.setLineWidth(0.1)
>               canvas.circle(self.size,self.size,self.size)
>
>But I have the error :
>ValueError: Flowable <FlowCircle at 11441584>... in cell(0,1) can't have
>auto width in
>
>I'm not sure if I must add a function for auto width. Did you experimented
>flowables in a table ?
>
>François
>
>_______________________________________________
>reportlab-users mailing list
>reportlab-users@reportlab.com
>http://two.pairlist.net/mailman/listinfo/reportlab-users

-- 
Robin Becker