Python Forum
Tkinter Listbox tab char issues
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter Listbox tab char issues
#1
Hello, I'm writing a GUI app in tkinter. Right now I am trying to insert filenames that I have stored in an SQL database into a Listbox with a tab in front of it. However the tab seems to always show up on the end. I have tried adding a char(9) to the front of the filenames in the SQL database and also a '\t' char when I am doing the actual inserting. I am using windows 10. Has anyone else had issues with this?

Thanks in advance.
Reply
#2
I think you will need to post your code for anyone to help. Please make sure to use code tags to display your code correctly.
Reply
#3
I am trying to insert a tab char in the SectionList.insert line, the problem is it seems to always end up in front of the string I am inserting.
values = self.Query("SELECT Filename FROM ShubertDocs WHERE Frame = '" + key + "' AND FrameSection = '" + element + "';")
i=0
for value in values:
    self.SectionList.insert(i, str(value[0]))
    i += 1
Reply
#4
In your first post you say the Tab is always at the end but in your second it's at the beginning. Which do you want it to be?
Has the data in the database got the Tabs in it or not?
If not where in the code you have shown do you think you are inserting it?
What about the rest of your code?
Reply
#5
The tab ends up on the END when I run the GUI tool, if I do this
 #Scroll bars for listbox
self.yScroll = Scrollbar(self.window, orient=VERTICAL)
self.xScroll = Scrollbar(self.window, orient=HORIZONTAL)    
small_font = font.Font(size=15)
self.SectionList = Listbox(self.window, height=23, width=30,selectmode=MULTIPLE,yscrollcommand=self.yScroll.set,xscrollcommand=self.xScroll.set, font=small_font)

values = self.Query("SELECT Filename FROM ShubertDocs WHERE Frame = '" + key + "' AND FrameSection = '" + element + "';")
i=0
for value in values:
    self.SectionList.insert(i, '\t' + str(value[0]))
    i += 1
If I add a CHAR(9) in the database to a file it also ends up on the END of the string that I am inserting. Either way when I run the tool in my listbox, I have a tab on the end of my string not the front. Do you want to see my whole program? not sure what other parts are relevant.

Thanks, sorry for not being more clear.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] scheduling and timining issues using mqtt and tkinter kiko4590 2 1,781 Apr-11-2022, 08:23 AM
Last Post: kiko4590
  tkinter| listbox.insert problem Maryan 3 3,438 Sep-29-2020, 05:34 PM
Last Post: Yoriz
  What units does the width parameter of a tkinter Listbox use? Pedroski55 2 5,442 Jul-04-2020, 08:17 AM
Last Post: deanhystad
  Tkinter - Issues with "iconbitmap" method aquerci 3 5,810 May-21-2020, 09:46 AM
Last Post: aquerci
  [Tkinter] tkinter listbox problem edoardo5782 5 6,481 Sep-10-2018, 07:10 PM
Last Post: edoardo5782
  How to format a list when displaying in a tkinter Listbox nortski 3 9,566 Apr-03-2018, 02:31 AM
Last Post: Larz60+
  Widget placement issues with tkinter grid thread 1 mgtheboss 2 4,317 Jan-09-2018, 03:59 PM
Last Post: SmokerX
  [Tkinter] THow to search a string in a file and display it in listbox by Tkinter mosavit 2 5,604 Jun-21-2017, 08:02 AM
Last Post: buran
  Help with tkinter Button and Label interaction issues ... sealyons 0 4,678 Jun-01-2017, 06:58 PM
Last Post: sealyons

Forum Jump:

User Panel Messages

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