I am experiencing a very weird situation here:
I have a program that uses tkinter and python 3, but its search function isn't working under Windows.
from tkinter import * import tkinter.ttk def sort(): pass def find(): start = 1.0 while 1: find = text_to_be_found.get() pos = textarea.search(find, start, stopindex=END) if not pos: break beginning = pos+"linestart" end = pos+"lineend" start = pos + "+1c" textarea.tag_add(SEL, beginning, end) window = tkinter.Tk() window.title("Help with find function") mainframe = tkinter.ttk.Frame(window, border=3, relief="sunken") textarea = Text(mainframe) button = tkinter.ttk.Button(mainframe, text="Sort", command=sort) button2 = tkinter.ttk.Button(mainframe, text="Find", command=find) text_to_be_found_label = tkinter.ttk.Label(mainframe, text="Find the following word: ",) text_to_be_found = tkinter.ttk.Entry(mainframe) mainframe.grid(row=0, column=0) textarea.grid(row=0, column=0, columnspan=2) button.grid(row=2, column=0) button2.grid(row=2, column=1) text_to_be_found_label.grid(row=3, column=0, pady=5) text_to_be_found.grid(row=3, column=1, pady=5) window.mainloop()
Write something in the text area and then try to use the little entry field to find one of the words you wrote in the text area. You'll see that it just doesn't work, whereas it does work right away under Linux.
Can somebody tell me what the problem is, isn't python suppossed to be platform independent??
Also, if someone has a better suggestion the function itself I have already asked about it in this topic: http://www.daniweb.com/forums/thread273351.html