[reportlab-users] Newbie syntax help
Christopher Lazzery
clazzery at mfsadmin.com
Thu Aug 7 17:00:33 EDT 2008
Hi everyone. I'm brand new to Python and ReportLab and I am just trying to find some good tutorials out there to get me started.
After reading up, I tried to start working with some of the functions to see if I could make something simple.
I was hoping someone could explain some of the parameters in this one function:
def box(flt, center=False):
box_style = [('BOX', (0, 0), (-1, -1), .5, colors.lightgrey)]
if center:
box_style += [('ALIGN', (0, 0), (-1, -1), 'CENTER')]
return Table([[flt]], style=box_style)
elements = []
styles = getSampleStyleSheet()
doc = SimpleDocTemplate('simplebox.pdf')
elements.append(box(Paragraph("Some Text Goes Here",
styles['Title'])))
doc.build(elements)
Now, that builds a simple string of text with a thin grey box around it, as I'm sure you can tell. I'm confused about the "(0, 0), (-1,-1)" in the box function though. From what I've read, I think those are coordinates, but I have no idea what they do (if they even are coordinates). If I change any of the numbers, the box doesn't move. It disappears. So, what are these parameters? Are they coordinates? I know this seems like a silly question, but neither the User Guide nor any other documentation I have found seems to explain it.
Thanks for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20080807/65dc5b63/attachment.html>
More information about the reportlab-users
mailing list