Python Forum

Full Version: Hide text in entry box when i click on it.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Guys,
Here i am creating a entry box with some text,i need to hide the text when i click on it.
Here is my code
from Tkinter import *
obj = Tk()
b = Entry(obj,width=100)
b.insert(0,"Enter the value to search")
b.pack()
mainloop()
Thanks in advance Smile
This could be a solution for this.
from Tkinter import *
def clear_search(event):
   b.delete(0, END) 
obj = Tk()
b = Entry(obj,width=100)
b.insert(0,"Enter the value to search")
b.bind("<Button-1>", clear_search) 
b.pack()
mainloop()
Smile