Inkscape.org
Creating New Extensions Switching to arg_parser
  1. #1
    DrWiggly DrWiggly @DrWiggly

    It seems that v1.x requires the use of argument parser instead of option parser. But where can one find the documentation for an arg_parser, the supported arguments to arg_parser.add_argument(.....) and the syntax for each type of argument?

  2. #2
    inklinea inklinea @inklinea⛰️

    https://inkscape.gitlab.io/extensions/documentation/source/inkex.base.html

    Top of this page.

    In .inx file

    <param name="number_of_sides" type="int" min="1" max="100" gui-text="Number of Sides">3</param>

    In .py file

    def add_arguments(self, pars):
        pars.add_argument("--number_of_sides", type=int, dest="sectors", default=6)

    To use value in the py file

    my_value = self.options.sectors
  3. #3
    DrWiggly DrWiggly @DrWiggly

    My apologies to the entire Inkscape developer's community. I did not realize that argparse is a facility provided by Python, not an Inkscape specific thing. So now I have found the documentation by searching Python documentation