Jan-08-2020, 09:54 PM
First you need the depth of the tree, which you can calculate from the list output. That will tell you how many items are in the last row of the 2d output. Then convert everything in the list output to strings, and determine the longest one. That will be the width for all of them. Now you can calculate the overall width: The (item width + 1) times (the number of items on the last row * 2 - 1). That accounts for the items on the last row, and the gaps for items on the previous rows. You add one to the item width to add a space between each item.
Then you go through the rows, figure out the number of items on each row, take those items from the list, and figure out how much space should be between each item. Use the join method on that much space between the items centered (another method) in their item width. Center all of that in the overall width.
Then you go through the rows, figure out the number of items on each row, take those items from the list, and figure out how much space should be between each item. Use the join method on that much space between the items centered (another method) in their item width. Center all of that in the overall width.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures