Skip to content

Text inputs with nargs don't work properly with list initial values #756

Open
@JozsefKutas

Description

@JozsefKutas
  • OS : Windows 10
  • Python Version : 3.9.6
  • Gooey Version : 1.0.8.1
  • Thorough description of problem
    • Expected Behavior
    • Actual Behavior

List initial values for text inputs with nargs don't get caught by the argparse_to_json.textinput_with_nargs_and_list_default condition, and so aren't properly transformed. I would expect initial_values to be handled in the same way as default values.

  • A minimal code example -- preferably copy/pastable in the issue itself (less time figuring out how to run your code == more time debugging!)
import gooey
from gooey import Gooey


@Gooey
def main():
    parser = gooey.GooeyParser(description='Sum some integers.')
    parser.add_argument('--integers', type=int, nargs='+', default=[2, 2])
    parser.add_argument('--integers2', type=int, nargs='+', gooey_options={'initial_value': [2, 2]})
    args = parser.parse_args()
    print(sum(args.integers) + sum(args.integers2))


main()
  • Screenshot (if visual quirk)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions