Python Forum
[Tkinter] THow to search a string in a file and display it in listbox by Tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] THow to search a string in a file and display it in listbox by Tkinter
#1
I was wondering how I can write a python code using Tkinter to search a string in an external txt file and display the lines in which the string appears in a listbox, highlighting the same string in each line. By the way, I am a new learner in the field.
Can anybody help me with coding on this issue?
Thanks in advance.
Reply
#2
Have a look at
https://www.tutorialspoint.com/python/py...trings.htm

https://stackoverflow.com/questions/3277...nto-a-list

and
http://effbot.org/tkinterbook/listbox.htm
Reply
#3
Welcome to the forum. While we a happy to help to solve any problems you may have, we are not going to do this for you. You need to show effort, post your code (and eventually traceback - the error message you get) in relevant tags and ask specific question.
As to the problem - split it in small parts and solve it one by one. In my opinion the GUI is the last element. Start with reading txt file, then expand the code to search for the string and return the line if found, at the end - start developing the GUI and if you have the functionality you can easy integrate it in the GUI.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Display IP address in listbox dominicrsa 2 599 Oct-21-2020, 01:00 PM
Last Post: dominicrsa
  tkinter| listbox.insert problem Maryan 3 958 Sep-29-2020, 05:34 PM
Last Post: Yoriz
  How to display results from terminal window onto tkinter. buttercup 0 973 Jul-21-2020, 04:41 AM
Last Post: buttercup
  What units does the width parameter of a tkinter Listbox use? Pedroski55 2 945 Jul-04-2020, 08:17 AM
Last Post: deanhystad
  [Tkinter] Problems to display Web Scraping values in Tkinter Lucas_Ribeiro 0 654 May-07-2020, 12:36 AM
Last Post: Lucas_Ribeiro
  Listbox search code partially works chesschaser 9 1,704 May-05-2020, 01:08 PM
Last Post: chesschaser
  [Tkinter] Tkinter - I need to read file excel from GUI app to script file johnjh 0 6,050 Apr-17-2020, 08:14 PM
Last Post: johnjh
  tkinter search box DT2000 3 4,681 Apr-08-2020, 05:59 AM
Last Post: DT2000
  tkInter and Pillow don't display any images in GUIs - program gives errors instead SomeRandomGuy 9 4,998 Oct-29-2019, 02:57 PM
Last Post: SomeRandomGuy
  [Tkinter] String variables in Tkinter rturus 2 1,134 Jun-12-2019, 11:21 AM
Last Post: rturus

Forum Jump:

User Panel Messages

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