MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_2411

Function test_2411

tests/test_widgets.py:187–209  ·  view source on GitHub ↗

Add combobox values in different formats.

()

Source from the content-addressed store, hash-verified

185
186
187def test_2411():
188 """Add combobox values in different formats."""
189 doc = pymupdf.open()
190 page = doc.new_page()
191 rect = pymupdf.Rect(100, 100, 300, 200)
192
193 widget = pymupdf.Widget()
194 widget.field_flags = (
195 pymupdf.PDF_CH_FIELD_IS_COMBO
196 | pymupdf.PDF_CH_FIELD_IS_EDIT
197 | pymupdf.PDF_CH_FIELD_IS_COMMIT_ON_SEL_CHANGE
198 )
199 widget.field_name = "ComboBox-1"
200 widget.field_label = "an editable combo box ..."
201 widget.field_type = pymupdf.PDF_WIDGET_TYPE_COMBOBOX
202 widget.fill_color = pymupdf.pdfcolor["gold"]
203 widget.rect = rect
204 widget.choice_values = [
205 ["Spain", "ES"], # double value as list
206 ("Italy", "I"), # double value as tuple
207 "Portugal", # single value
208 ]
209 page.add_widget(widget)
210
211
212def test_2391():

Callers

nothing calls this directly

Calls 2

new_pageMethod · 0.80
add_widgetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…