![]() ![]() In other words, if you create a series of radios one after the other, they will be grouped together. ReportLab does not appear to have a way to explicitly group a set of radio boxes as being together. Checkboxes are rarely limited to just allowing one checkbox per group. Radio widgets are kind of like checkboxes except that usually you put radio buttons into a group where only one radio button can be selected. If you open up the document and check all of the checkboxes, you will end up with them looking like this: ![]() I set the buttonStyle to something different for each of the checkboxes. If you turn it off though, the checkbox may become invisible, so you might want to set its background color via fillColor if you do that. You can play around with the width of the checkbox’s border or turn the border off. Then we set its position and a few other things. Now let’s write up a simple example that demonstrates how some of these arguments behave: # simple_checkboxes.pyįrom import magenta, pink, blue, greenĬ = canvas.Canvas('simple_checkboxes.pdf')įorm.checkbox(name='cb1', tooltip='Field cb1',įorm.checkbox(name='cb2', tooltip='Field cb2',įorm.checkbox(name='cb3', tooltip='Field cb3',įorm.checkbox(name='cb4', tooltip='Field cb4',įorm.checkbox(name='cb5', tooltip='Field cb5',Īs you can see, we set up the name and set the tooltip to basically match the name of the widget. ![]() ReportLab supports several different “check” styles though, so when the checkbox is checked, it can look different depending on the style that you set. The checkbox widget is exactly what it sounds like. ![]() Let’s take a look at the widgets that ReportLab supports! Note that you can only have one form per document. In this section, we will look at the following widgets:Īll of these widgets are created by calling various methods on the canvas.acroform property. ReportLab doesn’t support all of these elements, but it does cover most of them. The PDF standard actually has a fairly rich set of interactive elements. The ReportLab toolkit allows you to create interactive fillable forms. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |