Python Forum
[Tkinter] finding lines from a text entry - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] finding lines from a text entry (/thread-26481.html)



finding lines from a text entry - Sutsro - May-03-2020

Hey everyone i made a code to find lines that starts with adres however it doesnt work, any ideas would be appreciated.
def verial():
    #aşama 1 adres satırını alıyoruz.
    adressatırlistesi=[]
    satırsayısı=0
    input = text1.get("1.0",'end-1c')
    for line in input:
        satırsayısı=satırsayısı+1
        if line.startswith("Adres"):
            büroEntry.insert(0,"öyleyse dans")
           



RE: finding lines from a text entry - anbu23 - May-04-2020

Any errors? Can you post complete code?


RE: finding lines from a text entry - Sutsro - May-04-2020

Looks like i found the problem when importing from a text file, you have to .rsplit like this:

inputraw = text1.get("1.0",'end-1c')
input=inputraw.rsplit(" ")
after doing that if and search functions works verywell it took a day for me to figure this out. I was considering saving the get as txt file than reopening it :).