6

I have created a python toolbox containing a number of classes which define the various tools within. As these classes are part of a workflow in which the tools are to be executed sequentially using outputs from the previous tools, it would be very handy if the tools were presented in this order within the box, reinforcing the workflow. However, they appear to be displayed alphabetically. Is there a way to define the order? The tools are entered into the class Toolbox attribute list, self.tools[tool1, tool2] in the proper order, but they are subsequently alphabetized before being displayed.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 6, 2014 at 20:15
2
  • 3
    As far as I know, this is unavoidable in both Python toolboxes and regular toolboxes. The workaround I've used is to add a number before the tool name, to correspond to the workflow: "1. First Step", "2a. Second Step, Part 1", "2b. Second Step, Part 2", etc. Commented Oct 6, 2014 at 20:44
  • I had a feeling that was the case. Not a bad solution really, just wondering if it was necessary to get the desired results. Commented Oct 6, 2014 at 21:05

1 Answer 1

2

As @nmpeterson stated, we also had to add a prefix to the tool name to get the desired sorting. However, if memory serves, we used alpha characters first

A- Tool number 1
B- Tool number 2

because if the number of tools creep in to the double digits, the tools will still be sorted alphabetically rather than numerically.

1 - Tool number 1
11 - Tool number 11
2 - Tool number 2
nmpeterson
8,42334 silver badges60 bronze badges
answered Oct 7, 2014 at 3:32
2
  • 2
    Good point. If numbers are desired but 10+ tools are present, you can of course use '01', '02', etc. Commented Oct 7, 2014 at 3:48
  • Ah true +1 for that. Commented Oct 7, 2014 at 4:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.