0

I am using the concat function to convert several database fields to be entered into a Tkinter Combobox.

Data:
first_name  last_name       city        state   ID
John        Smith           Dallas      TX      1
Richard     Cunningham      Ft. Worth   TX      2
'''
        SELECT concat (first_name,' ',last_name,' ', city,', ',state,' '),ID
'''
Results:
{'John Smith Dallas, TX':1, 'Richard Cunningham Ft. Worth, TX' :2 }

What I would like to do is format the string so that for example Smith would take the same number of characters as Cunningham. Then when I put the data into the cb it would appear as columns.

Thanks for any help.

zabop
  • 6,750
  • 3
  • 39
  • 84

1 Answers1

0

A good solution would be to create a table instead of a cb. A solution/ description for this is shown Here (stackoverflow - does tkinter have a table widget).

Otherwise you could take advantage of libraries (or there logic) such as texttable or asciitable to format your text appropriately. A solution for general asciitable can be found here - (stackoverflow - How can I pretty print ascii tables)

Cobalt
  • 447
  • 5
  • 9