0
最近我一直在研究GUI python純文本編輯器。該代碼調用此功能無法獲取python 2.7 tkinter文本編輯器查找功能工作
def Find():
win = Toplevel()
Label(win, text="Find:").pack()
e1 = Entry(win)
e1.pack()
Button(win, text="Find Me!!!!", command=win.destroy).pack()
targetfind = e1.get()
print targetfind
if targetfind:
where = textPad.search(targetfind, INSERT, END)
if where:
print where
pastit = where + ('+%dc' % len(targetfind))
#self.text.tag_remove(SEL, '1.0', END)
textPad.tag_add(SEL, where, pastit)
textPad.mark_set(INSERT, pastit)
textPad.see(INSERT)
textPad.focus()
但是,我無法讓它工作。我搜索了互聯網尋找任何可能幫助我實現查找功能的東西,但是我沒有成功找到一個可行的方法。非常感謝在實現查找功能方面的任何幫助。
我使用python 2.7.7,Tkinter的,而我在Windows 7 `
謝謝你,你的回答是有效的,很明顯,它很好地解釋了。如果我有足夠的聲望,我會投票。 – 2015-02-05 23:14:53