Reputation: 1179
My goal is to create a floating table with PyLatex
, to do this I want to use the class Table
. But when I initialize a Table
I get the following error:
Traceback (most recent call last):
File "table.py", line 18, in <module>
table = Table('rc|cl')
TypeError: __init__() takes exactly 1 argument (2 given)
This is really confusing as I consider 'rc|cl'
as 1 argument. To make sure I make nothing wrong I executed a script from Nullege, which results in the error above.
Upvotes: 0
Views: 240
Reputation: 1179
As Feodoran mentioned in his comment the Tabular must be wrapped inside a Table to make it float.
doc = Document()
with doc.create(Table()):
with doc.create(Tabular("llr")) as tabular:
tabular.add_row(("Foo", "Bar", "Foobar"))
tabular.add_hline()
# etc
Upvotes: 1