Hello Guys,
Here i am creating a GUI which will act as a search engine that will find the 
results from the browser and save the results as a xls file.
When i typed something in my search box and click the (GO)button.It should 
display search in progress.when the file is saved it should display done.
How to do that?
My button gets hung for a seconds.We should give any timeout for that?

Here is my script
<python>
from Tkinter import *
import mechanize
def clear_search(event):
    search.delete(0,END)
obj = Tk()
Label = Label(obj,text="Top Findings:",font="-weight bold")
search = Entry(obj,width=100)
search.insert(0, "Enter the value to search")
search.bind("<Button-1>", clear_search)
def fun():
    new = search.get()
    url = "http://duckduckgo.com/html";
    br = mechanize.Browser()
    br.set_handle_robots(False)
    br.open(url)
    br.select_form(name="x")
    br["q"] = str(new)
    res = br.submit()
    content = res.read()
    with open("result1.xls", "w") as f:
        f.write(content)
fun()
Go = Button(obj,text="GO",width=5,command=fun)
Label.pack()
search.pack()
Go.pack()
mainloop()
</python>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to