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

Rhodri James rhodri at kynesim.co.uk
Fri May 31 15:24:17 EDT 2019


On 31/05/2019 20:08, sakshamraheja11 at gmail.com wrote:
> 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()

Spot the difference between the identifiers I underlined.  If you run 
this from the command line, the traceback tells you exactly what is 
going on.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-list mailing list