[reportlab-users] Custom Flowables - Can't get shapes.Drawing() to paint to the story/canvas

J. R. Carroll jrcarroll at jrcresearch.net
Thu Nov 29 15:17:04 EST 2012


Funny as you sent this, I got so frustrated trying to making a custom
flowable, I reverted my code back to a stage where I am doing exactly as
you suggest.

I suppose I was trying to build in more flexibility with the script so that
way if I changed the dimensions (say from Letter to A4) it would still work
- that way other people can use this script besides me!

Any thoughts on how to account changing the page size and controlling the
placement of the grids+grid labels?

-J


----


J. R. Carroll
Independent Researcher through Hurtz Labs
Research Methods, Test Development, and Statistics
www.jrcresearch.net
Cell: (650) 776-6613
Email: jrcarroll at jrcresearch.net
jrcarroll at hurtzlab.com
jrc.csus at gmail.com
jcarroll at comiratesting.com




On Thu, Nov 29, 2012 at 3:12 PM, Tim Roberts <timr at probo.com> wrote:


> J. R. Carroll wrote:

> >

> > I haven't forgotten about my other thread, but in preparation to

> > (hopefully) finalize my findings and report back, I started making a

> > "print test page" (which, once I am done, I'd be happy to share).

> >

> > I am having a problem following the reportlab manual/examples online

> > for creating my own custom flowable. As I understand it, a

> > shapes.Drawing() object is not a flowable by default (correct?). If I

> > want it to be a flowable I have to create my own flowable object

> > wrapped around it (or did I misunderstand)?

> >

> > I have created my own custom class to deal with the strip chart grids

> > I am working with (as noted in my previous thread I started), but I

> > cannot get the class to return a flowable that story.build() can work

> > with (see the error at the bottom of this email).

> >

> > What I am trying to achieve is a "small sample grid" (which is drawn

> > by my class), then immediately below that is the grid color name + RGB

> > color reference. Eventually, I was going to build it so it would

> > print 4-wide, and as many necessary "down". So it would be a matrix

> > of finely printed, super small/fine, grid lines with different colors

> > (which I can then use to determine which colors would work best on a

> > variety of printers + work with our marketing department and MD's to

> > select the colors that will work the best in the field (and be accepted).

>

> This is not the right approach. The immediate problem is that you are

> taking a flowable (your Grid_test) and trying to use it as the contents

> of another flowable (Paragraph). That won't work.

>

> Do you really need the flowable/story approach? That is, are you really

> in a situation where you want to have ReportLab decide on the placement

> and flow of the individual components? I would have guessed you

> weren't. If you want things laid out in a grid with specific

> placements, then forget about platypus entirely: forget about

> DocTemplates and flowables and stories. Just create your own canvas,

> and draw the stuff you need exactly where you need it. It's like the

> difference between doing a drawing in Word and doing it in Visio.

>

> I tend to be a bit of a control freak -- I like to know exactly where

> things are going to be -- so I almost NEVER use the flowable part of

> ReportLab. I always draw directly to a canvas.

>

> --

> Tim Roberts, timr at probo.com

> Providenza & Boekelheide, Inc.

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20121129/261b7f2d/attachment.html>


More information about the reportlab-users mailing list