当前位置: 首页>>代码示例>>Python>>正文


Python GooeyParser.add_argument方法代码示例

本文整理汇总了Python中gooey.GooeyParser.add_argument方法的典型用法代码示例。如果您正苦于以下问题:Python GooeyParser.add_argument方法的具体用法?Python GooeyParser.add_argument怎么用?Python GooeyParser.add_argument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gooey.GooeyParser的用法示例。


在下文中一共展示了GooeyParser.add_argument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    parser = GooeyParser(description='Zelda clean this mess\nReorganize date/pod -> pod/date')
    parser.add_argument('pattern', nargs='?', default=r"""(.*)_(.*)_(.*)_(.*)_(.*)_(.*)-(.{8})-(.*).datx_(.*)""",
                        help="pattern which allow to get groups\nmoteur = mo.group(1)\nuseless = mo.group(2)\nbanc = mo.group(3)\npod = mo.group(4)\nuseless = mo.group(5)\nrun = mo.group(6)\ndate = mo.group(7)\nheure = mo.group(8)")
    parser.add_argument('srcDir', nargs='?', default=os.getcwd(), widget='FileChooser',
                        help='Engine directory : root/???/*.*')

    args = parser.parse_args()
    Zelda.trier(args.srcDir, args.pattern)
开发者ID:K007024,项目名称:Zelda,代码行数:11,代码来源:ZeldaGUI.py

示例2: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    parser = GooeyParser(prog="example_progress_bar_2")
    parser.add_argument("steps", type=int, default=15)
    parser.add_argument("delay", type=int, default=1)
    args = parser.parse_args(sys.argv[1:])

    for i in range(args.steps):
        print("progress: {}/{}".format(i+1, args.steps))
        sys.stdout.flush()
        sleep(args.delay)
开发者ID:chriskiehl,项目名称:GooeyExamples,代码行数:12,代码来源:example_progress_bar_2.py

示例3: get_params

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def get_params():
    parser = GooeyParser()
    parser.add_argument('search_term', help="The search term")
    parser.add_argument(
        dest='mode',
        widget='Dropdown',
        choices=['Director', 'IMDB Code', 'Keyword']
    )
    args = parser.parse_args()
    return args.mode, args.search_term
开发者ID:rchrd-blkly,项目名称:100daysofcode-with-python-course,代码行数:12,代码来源:program.py

示例4: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    parser = GooeyParser(description="Calculate a rocket stage's delta V for KSP")
    parser.add_argument("mass_initial", help="Initial mass of the spacecraft (tonnes)", type=float)
    parser.add_argument("mass_final", help="Final mass of the spacecraft (tonnes)", type=float)
    parser.add_argument("isp", help="Specific impulse", type=float)
    parser.add_argument("--thrust", help="Thrust per engine (0 for unknown)", type=float, default=0.0)
    parser.add_argument("--engine_count", help="Number of engines", type=int, default=1)
    args = parser.parse_args()

    thrust = args.thrust * args.engine_count

    get_and_process_stage(args.mass_initial, args.mass_final, args.isp, thrust)
开发者ID:alexgit53,项目名称:DeltaVCalc,代码行数:14,代码来源:DeltaVCalc.py

示例5: arbitrary_function

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def arbitrary_function():
  desc = u"\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u5f15\u6570\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044"
  file_help_msg = u"\u51e6\u7406\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d"
  my_cool_parser = GooeyParser(description=desc)
  my_cool_parser.add_argument(u"\u30d5\u30a1\u30a4\u30eb\u30d6\u30e9\u30a6\u30b6", help=file_help_msg, widget="FileChooser")   # positional

  my_cool_parser.add_argument('-d', u'--\u30c7\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3', default=2, type=int, help=u'\u30d7\u30ed\u30b0\u30e9\u30e0\u51fa\u529b\u306e\u671f\u9593\uff08\u79d2\uff09')
  my_cool_parser.add_argument('-s', u'--\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb', type=int, help=u'\u65e5\u6642\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u958b\u59cb\u3059\u3079\u304d', widget='DateChooser')
  my_cool_parser.add_argument("-c", u"--\u30b7\u30e7\u30fc\u30bf\u30a4\u30e0", action="store_true", help=u"\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u30bf\u30a4\u30de\u30fc\u3092\u8868\u793a\u3057\u307e\u3059")
  my_cool_parser.add_argument("-p", u"--\u30dd\u30fc\u30ba", action="store_true", help=u"\u4e00\u6642\u505c\u6b62\u306e\u5b9f\u884c")

  args = my_cool_parser.parse_args()
  main(args)
开发者ID:pombredanne,项目名称:GooeyExamples,代码行数:15,代码来源:language_demo_japanese.py

示例6: arbitrary_function

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def arbitrary_function():
    desc = u"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u002c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c "
    file_help_msg = u"\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430\u002c \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c"

    my_cool_parser = GooeyParser(description=desc)

    my_cool_parser.add_argument(
        'foo',
        metavar=u"\u0432\u044b\u0431\u043e\u0440\u0430\u0444\u0430\u0439\u043b\u043e\u0432",
        help=file_help_msg,
        widget="FileChooser")

    my_cool_parser.add_argument(
        'bar',
        metavar=u"\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c",
        help=file_help_msg,
        widget="MultiFileChooser")

    my_cool_parser.add_argument(
        '-d',
        metavar=u'--\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c',
        default=2,
        type=int,
        help=u'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0028 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0029 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b')

    my_cool_parser.add_argument(
        '-s',
        metavar=u'--\u043a\u0440\u043e\u043d \u002d \u0433\u0440\u0430\u0444\u0438\u043a',
        help=u'\u0414\u0430\u0442\u0430',
        widget='DateChooser')

    args = my_cool_parser.parse_args()
    main(args)
开发者ID:chriskiehl,项目名称:GooeyExamples,代码行数:35,代码来源:language_demo_russian.py

示例7: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    parser = GooeyParser(description='Process some integers.')

    parser.add_argument(
        'required_field',
        metavar='Some Field',
        help='Enter some text!')

    parser.add_argument(
        '-f', '--foo',
        metavar='Some Flag',
        action='store_true',
        help='I turn things on and off')

    args = parser.parse_args()
    print('Hooray!')
开发者ID:chriskiehl,项目名称:GooeyExamples,代码行数:18,代码来源:simple_demo.py

示例8: _parser

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def _parser():
    parser = GooeyParser(description='Look up an object in VizieR'
                                                 ' and print mean/median'
                                                 ' values of given parameters')
    parser.add_argument('object', help='Object, e.g. HD20010', nargs='+')
    parser.add_argument('-p', '--params', default=True, action='store_true',
                        help='List of parameters (Teff, logg, [Fe/H] be default)')
    parser.add_argument('-m', '--method', choices=['median', 'mean', 'both'], default='both',
                        help='Which method to print values (mean or median). Default is both')
    parser.add_argument('-c', '--coordinate', default=False, action='store_true',
                        help='Return the RA and DEC (format for NOT\'s visibility plot)')
    return parser.parse_args()
开发者ID:gdcteixeira,项目名称:astro_scripts,代码行数:14,代码来源:vizier_query.py

示例9: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    my_cool_parser = GooeyParser(description='This Demo will raise an error!')
    my_cool_parser.add_argument(
        "explode",
        metavar='Should I explode?',
        help="Determines whether or not to raise the error",
        choices=['Yes', 'No'],
        default='Yes')

    args = my_cool_parser.parse_args()
    if 'yes' in args.explode.lower():
        print('Will throw error in')
        for i in range(5, 0, -1):
            print(i)
            time.sleep(.7)
        raise Exception(BOOM)

    print(NO_BOOM)
    print('No taste for danger, eh?')
开发者ID:chriskiehl,项目名称:GooeyExamples,代码行数:21,代码来源:error_demo.py

示例10: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    desc = 'Converts *.spc binary files to text using the spc module'
    parser = GooeyParser(description=desc)
    parser.add_argument('filefolder', widget='DirChooser', help='Input directory containing spc file')
    fformat = parser.add_mutually_exclusive_group()
    fformat.add_argument('-c', '--csv', help='Comma separated output file (.csv) [default]',
                         action='store_true')
    fformat.add_argument('-t', '--txt', help='Tab separated output file (.txt)',
                         action='store_true')
    args = parser.parse_args()

    if args.txt:
        exten = '.txt'
        delim = '\t'
    else:
        # defaults
        exten = '.csv'
        delim = ','

    flist = []

    # only directory here
    ffn = os.path.abspath(args.filefolder)
    for f in os.listdir(ffn):
        flist.append(os.path.join(ffn, f))

    # process files
    for fpath in flist:
        if fpath.lower().endswith('spc'):

            foutp = fpath[:-4] + exten
            try:
                print(fpath, end=' ')
                f = spc.File(fpath)
                f.write_file(foutp, delimiter=delim)
                print('Converted')
            except:
                print('Error processing %s' % fpath)
        else:
            print('%s not spc file, skipping' % fpath)
开发者ID:EloisaElias,项目名称:spc,代码行数:42,代码来源:convert_gui.py

示例11: _parser

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def _parser():
    '''The argparse stuff'''

    parser = GooeyParser(description='CRIRES spectrum to an 1D spectrum')
    parser.add_argument('fname', action='store', widget='FileChooser', help='Input fits file')
    parser.add_argument('--output', default=False,
                        help='Output to this name. If nothing is given, output will be: "wmin-wmax.fits"')
    parser.add_argument('-u', '--unit', default='angstrom',
                        choices=['angstrom', 'nm'],
                        help='The unit of the output wavelength')
    parser.add_argument('-c', '--clobber', default=True, action='store_false',
                        help='Do not overwrite existing files.')
    args = parser.parse_args()
    return args
开发者ID:gdcteixeira,项目名称:astro_scripts,代码行数:16,代码来源:CRIRES2ARES.py

示例12: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
    parser = GooeyParser(description="PowerPoint Exporter")
    parser.add_argument('powerpoint', widget="FileChooser")
    parser.add_argument('output', help="Folder to place resulting images", widget="DirChooser")
    parser.add_argument('width', help="Width of resulting image (0-3072)")
    parser.add_argument('height', help="Height of resulting image (0-3072)")
    args = parser.parse_args()

    if not (os.path.isfile(args.powerpoint) and os.path.isdir(args.output)):
        raise "Invalid paths!"

    export_presentation(args.powerpoint, args.output, args.width, args.height)

    print "Done!"
开发者ID:8BitAce,项目名称:PPExport,代码行数:16,代码来源:ppexport.py

示例13: parse_args

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def parse_args(progress_regex=r"^progress: (\d+)%$",
       disable_stop_button=True):
    """ Use GooeyParser to build up the arguments we will use in our script
    Save the arguments in a default json file so that we can retrieve them
    every time we run the script.
    """
    
    stored_args = {}
    # get the script name without the extension & use it to build up
    # the json filename
    script_name = os.path.splitext(os.path.basename(__file__))[0]
    args_file = "{}-args.json".format(script_name)
    # Read in the prior arguments as a dictionary
    if os.path.isfile(args_file):
        with open(args_file) as data_file:
            stored_args = json.load(data_file)
    parser = GooeyParser(description='Mail Merge')
    parser.add_argument('data_directory',
                        action='store',
                        default=stored_args.get('data_directory'),
                        widget='DirChooser',
                        help="Source directory that contains Excel files")
    
    parser.add_argument('output_directory',
                        action='store',
                        widget='DirChooser',
                        default=stored_args.get('output_directory'),
                        help="Output directory to save merged files")

    #parser.add_argument("FileSaver", help="Name the output file you want to process", widget="FileSaver")
    #parser.add_argument("-o", "--overwrite", action="store_true", help="Overwrite output file (if present)")
    #parser.add_argument("-s", "--sheets", action="store_true", help="Would you like to ignore multiple sheets?")

    args = parser.parse_args()
    # Store the values of the arguments so we have them next time we run
    with open(args_file, 'w') as data_file:
        # Using vars(args) returns the data as a dictionary
        json.dump(vars(args), data_file)
    return args
开发者ID:mailMerge,项目名称:MailMerge,代码行数:41,代码来源:mailMerge.py

示例14: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def main():
  desc = "Example application to show Gooey's various widgets"
  my_cool_parser = GooeyParser(description=desc)
  my_cool_parser.add_argument("Example", help="fill ", widget="FileChooser")   # positional
  verbosity = my_cool_parser.add_mutually_exclusive_group()
  verbosity.add_argument('-t', '--verbozze', dest='verbose', action="store_true", help="Show more details")
  verbosity.add_argument('-q', '--quiet', dest='quiet', action="store_true", help="Only output on error")
  print my_cool_parser._actions
  print 'inside of main(), my_cool_parser =', my_cool_parser

  args = my_cool_parser.parse_args()
  print sys.argv
  print args.countdown
  print args.showtime

  start_time = _time()
  print 'Counting down from %s' % args.countdown
  while _time() - start_time < args.countdown:
    if args.showtime:
      print 'printing message at: %s' % _time()
    else:
      print 'printing message at: %s' % hashlib.md5(str(_time())).hexdigest()
    _sleep(.5)
  print 'Finished running the program. Byeeeeesss!'
开发者ID:pombredanne,项目名称:GooeyExamples,代码行数:26,代码来源:error_demo.py

示例15: parse_args_gooey

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_argument [as 别名]
def parse_args_gooey():
  '''parse command line arguments'''
  parser = GooeyParser(description="Convert pgm image to png or jpg")    
    
  parser.add_argument("directory", default=None,
                    help="directory containing PGM image files", widget='DirChooser')
  parser.add_argument("--output-directory", default=None,
                    help="directory to use for converted files", widget='DirChooser')
  parser.add_argument("--format", default='png', choices=['png', 'jpg'], help="type of file to convert to (png or jpg)")
  return parser.parse_args()
开发者ID:monkeypants,项目名称:cuav,代码行数:12,代码来源:pgm_convert.py


注:本文中的gooey.GooeyParser.add_argument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。