Python Forum

Full Version: Setting Tabs in a listbox
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using Python 3.8 and using Tkinter. I'm trying to set tabs inside of a listbox. I have the following code:

for record in records:
    txt =str(record[0]) + '\t' + '\t' + '\t' + str(record[1])
    lb.insert("end", txt )
But it doesn't do tabs. Both records are up against each other when displayed in the listbox. Any help would be appreciated.
try: (python 3.6 or newer)
lb.insert("end", f"{record[0]}\t\t\t{record[1]}")
That worked. Thank you.