Hide text in entry box when i click on it.(GUI using Tkinter in python)

sakshamraheja11 at gmail.com sakshamraheja11 at gmail.com
Fri May 31 15:08:19 EDT 2019


NOT WORKING IN MINE PLZ HELP



from tkinter import *
g=Tk()
g.geometry("{0}x{1}+0+0".format(g.winfo_screenwidth(), g.winfo_screenheight()))
g.title("Check")
g.configure(background='powder blue')


def clear_search(event): 
    e1.delete(0, tk.END) 

e1=Entry(g)
e1.insert(0,'username')
e1.pack()
e1.bind("<Button-1>", clear_search)
e1.bind("<FocusIn>", clear_search)

g.mainloop()


More information about the Python-list mailing list