Welcome to the forum!
Before trying to render to PDF you should try to render to the browser. If it doesn’t work on the browser it will not work to PDF.
If you add a button that shows the form, for example with this:
def button_2_click(self, **event_args):
open_form('Form1.Form2',
"Test header",
[
["Row 1", "row 1 field 1", 'item 1', 'item 2'],
["Row 2", "row 2 field 1", 'item 1', 'item 2', 'item 3'],
["Row 3", "row 3 field 1", 'item 1', 'item 2'],
["Row 4", "row 4 field 1", 'item 1'],
])
you will see that the form doesn’t work on the browser either.
And while you try that, you will see an error message on the left panel of the IDE saying SyntaxError: Tuple unpacking with stars is not supported
. This is one of the limitations of Skulpt, the javascript based Python interpreter. There are a few limitations, but they usually have easy workarounds.
The following changes allow the form to show on the browser and to render as PDF:
def button_2_click(self, **event_args):
open_form('Form1.Form2',
"Test header",
[
["Row 1", "row 1 field 1", ['item 1', 'item 2']], # use a list here to avoid unpacking on the client side
["Row 2", "row 2 field 1", ['item 1', 'item 2', 'item 3']],
["Row 3", "row 3 field 1", ['item 1', 'item 2']],
["Row 4", "row 4 field 1", ['item 1']],
])
user, total, months = self.item # the 3rd item is already a list, no need to unpack
self.label_1.text = user
self.label_2.text = total
for month in months:
Label(text=month, align='right') # right must be in quotes