0

I have a script which utilizes optional arguments with the help of argparse. When the optional arguments are not in use they default to None. I'm trying to build a GUI for the script with PySimpleGUI. The types for these optional arguments are:

  • Directories
  • Text files
  • Integers

I looked, but I could not find anything in the documentation with regard to having fields for optional arguments. What needs to be specified for optional directories, files, and integers?

The code to call on files is:

[sg.Text('Choose an optional text file:', size=(100, 1)), sg.Input(), sg.FileBrowse()]

The code to call on directories is:

[sg.Text('Choose an optional directory:', size=(100, 1)), sg.Input(), sg.FolderBrowse()]

The code to get an integer is:

[sg.Text('Enter optional number to the right:', size=(100,1)),sg.Spin(values=[i for i in range(1, 100000)], initial_value=1, size=(6, 1))]
J.spenc
  • 339
  • 2
  • 3
  • 11

1 Answers1

0

What you want to do is something like...

if args.dir is None:
   # ask for dir
if args.files is None:
   # ask for files
if args.inter is None:
   # ask for integer
Elijah
  • 1,814
  • 21
  • 27