Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting Tabs in a listbox
#1
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.
Reply
#2
try: (python 3.6 or newer)
lb.insert("end", f"{record[0]}\t\t\t{record[1]}")
Reply
#3
That worked. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Buttons not working in tabs kenwatts275 2 1,366 May-02-2022, 04:45 PM
Last Post: kenwatts275
  PYQT charts in tabs frohr 10 4,381 Feb-13-2022, 04:31 PM
Last Post: Axel_Erfurt
  create new tabs and populate using python reggie4 2 2,259 Jan-23-2021, 11:25 PM
Last Post: Larz60+
  HELP TabError: inconsistent use of tabs and spaces in indentation blackjesus24 2 3,546 Jan-30-2020, 10:25 AM
Last Post: blackjesus24
  removing spaces/tabs after used .strip() zarize 0 1,582 Sep-11-2019, 12:46 PM
Last Post: zarize
  removing tabs from input text jenya56 3 3,219 Mar-28-2019, 03:10 PM
Last Post: DeaD_EyE
  Why interpreter accepts indentation made with spaces and not those by tabs sylas 13 5,544 Jan-10-2019, 11:17 PM
Last Post: texadactyl
  Geany frustration how to deal with tabs and spaces and CR mlytle0 2 4,447 Sep-14-2017, 11:51 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020