get_form_input(fields, title)[source]

get_from_input Prompts the user for a set of inputs specified in fields with given title. The fields parameter is a list which can contain the following types:

  • str - an alias for LabelField

  • None - an alias for SeparatorField

  • LabelField - Text output

  • SeparatorField - Vertical spacing

  • TextLineField - Prompt for a string value

  • MultilineTextField - Prompt for multi-line string value

  • IntegerField - Prompt for an integer

  • AddressField - Prompt for an address

  • ChoiceField - Prompt for a choice from provided options

  • OpenFileNameField - Prompt for file to open

  • SaveFileNameField - Prompt for file to save to

  • DirectoryNameField - Prompt for directory name

This API is flexible and works both in the UI via a pop-up dialog and on the command-line. :params list fields: A list containing of the above specified classes, strings or None :params str title: The title of the pop-up dialog. :Example:

>>> int_f = IntegerField("Specify Integer")
>>> tex_f = TextLineField("Specify name")
>>> choice_f = ChoiceField("Options", ["Yes", "No", "Maybe"])
>>> get_form_input(["Get Data", None, int_f, tex_f, choice_f], "The options")
Get Data

Specify Integer 1337 Specify name Peter The options 1) Yes 2) No 3) Maybe Options 1 >>> True >>> print(tex_f.result, int_f.result, choice_f.result) Peter 1337 0