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
Smile Unable to display Devanagari ligatures correctly in python tkinter Anamika 4 1,273 Nov-26-2024, 08:08 PM
Last Post: woooee
  [Tkinter] Search data in treeview without search button TomasSanchexx 3 3,535 Aug-12-2023, 03:17 AM
Last Post: deanhystad
  [PyQt] [solved] How to display a pdf-file in a PyQt6 widget BigMan 13 24,267 May-06-2023, 09:27 AM
Last Post: Axel_Erfurt
  [PyQt] [Solved]Display Search Results in QTable Extra 5 4,155 Jun-29-2022, 10:20 PM
Last Post: Extra
  why my list changes to a string as I move to another window in tkinter? pymn 4 3,594 Feb-17-2022, 07:02 AM
Last Post: pymn
  [Tkinter] Display IP address in listbox dominicrsa 2 2,851 Oct-21-2020, 01:00 PM
Last Post: dominicrsa
  tkinter| listbox.insert problem Maryan 3 4,988 Sep-29-2020, 05:34 PM
Last Post: Yoriz
  How to display results from terminal window onto tkinter. buttercup 0 4,379 Jul-21-2020, 04:41 AM
Last Post: buttercup
  What units does the width parameter of a tkinter Listbox use? Pedroski55 2 7,782 Jul-04-2020, 08:17 AM
Last Post: deanhystad
  [Tkinter] Problems to display Web Scraping values in Tkinter Lucas_Ribeiro 0 2,005 May-07-2020, 12:36 AM
Last Post: Lucas_Ribeiro

Forum Jump:

User Panel Messages

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