Page 1 of 1

pythonscript for translation into Tkinter

Posted: Sat Aug 08, 2020 9:31 am
by input
I would like to translate this pythonscript to Tkinter.
I got this python script from youtube and I searched for a similar Tkinterscript on the internet but couldn't find anything.
I also have some Ebooks from Tkinter, but I don't have a similar Tkinter script.
Is there anyone who can translate this script for me into a Tkinter script

Code: Select all

 fh = open ("c:\Worddatabase\info.txt ", "r")
word = input("Enter word to search:")
s = " "
count = 1
L = fh.readlines()
for i in L:
    L2 = i.split()
    if word in L2:
        print ("Line number", count,":",i)
    count+=1

			

Re: pythonscript for translation into Tkinter

Posted: Sun Aug 09, 2020 5:39 pm
by joelostinspace
hey your script has bugs, it doesn't detect or find the last word in a sentence or first word in quote or capitalized words, here's a sentence from my text file.

Code: Select all

“Never tell the truth to people who are not worthy of it.”Mark Twain
doesn't detect Never, it or Mark
to clean it up try:
maybe add a rstrip https://python-reference.readthedocs.io ... strip.html
or strip https://python-reference.readthedocs.io ... strip.html
or string to change to all lower or upper case,
here's a book to help your programming gui https://www.oreilly.com/library/view/pr ... 449398712/
but to start out with gui's is the hard way, you need to get the python basics down first..
best of luck