[reportlab-users] How to draw lines between flowables?

Eric Hochmeister erichochmeister at gmail.com
Wed Feb 9 11:31:33 EST 2005


Hi all,

Ok, well I thought about it some more and thought why not just wrap
the line drawing in a Flowable class.  So I did this and came up with
...


class MCLine(Flowable):
   """Line flowable --- draws a line in a flowable"""

   def __init__(self,width):
      Flowable.__init__(self)
      self.width = width

   def __repr__(self):
      return "Line(w=%s)" % self.width

   def draw(self):
      self.canv.line(0,0,self.width,0)


It seems that this works fine.  Is this the recommended way of doing
this... or am I approaching this from the wrong angle?

Thanks,

Eric

------------------------------------------------------

>Hi,
>
>I was wondering how you insert lines between flowables?  For instance,
>if I had two paragraphs and I wanted to separate them by a line, how
>would I go about doing this?  Is it possible to embed the line in a
>flowable?  I would want this because I want the line to be drawn after
>the dynamic data which populates the paragraph above it and I just
>don't want to draw a line to a predefined position on the page.  Is
>this possible?  Can anyone help me out here?
>
>Thanks,
>
>Eric


More information about the reportlab-users mailing list