I want to make find in my text editor like in mozilla firefox on the bottom of my gui
this is only for learning.
class MyClass(Frame):
def onFind(self, target=None):
if target == None:
target = tkSimpleDialog.askstring('Find!', 'Search for string!')
if target:
where = self.text.search(target, INSERT, END)
if where:
pastit = where + ('+%dc' % len(target))
self.text.tag_remove(SEL, '1.0', END)
self.text.tag_add(SEL, where, pastit)
self.text.mark_set(INSERT, pastit)
self.text.see(INSERT)
self.text.focus()
def findToolbar(self):
frm = Frame(self.master)
frm.pack(side=BOTTOM, expand=YES, fill=X)
Button(frm, text='Quit!').pack(side=LEFT)
e = Entry(frm)
e.pack(side=LEFT)
e.focus_set()
target = e.get()
b = Button(frm, text='find', command=lambda: self.onFind(target))
b.pack(side=LEFT)
How to make when I open find toolbar that i dont have possibiliti to open the toolbar again when first is opened.
It seems that I cant get text from Entry, my target is empty