[reportlab-users] Re: Tablestyle.add() tuple unpack problem

Derek Basch reportlab-users@reportlab.com
Wed, 25 Sep 2002 22:14:58 -0700 (PDT)

I see what you mean about putting a list within a
list. I fixed it and it works great. I can add
tablestyle elements on the fly now. Makes for some
great reports. My problem was that I used the manual
as reference: 


This method allows you to add commands to an existing
TableStyle, i.e. you can build up
TableStyles in multiple statements.

LIST_STYLE.add([('BACKGROUND', (0,0), (-1,0),

This is obviously wrong! If anyone with ReportLab is
reading this please fix this error :).
Derek Basch


Disclaimer:  I'm also slogging up the ReportLab
learning curve.

Disclaimer aside, I think the problem is in the syntax
of the 'add' 
method.  You have:

tblstyle.add([('BACKGROUND', (0,0), (-1,0),

When you use TableStyle you're creating a list of
tuples.  When you 
execute the above statement, you're putting a list
within a list.  
That's fine syntactically with Python but causing an
error with 

Try this:

tblstyle.add('BACKGROUND', (0,0), (-1,0),

The ReportLab supplied example test_platypus_tables.py
has helped me 

Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!