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

Chris Angelico rosuav at gmail.com
Fri May 31 15:23:53 EDT 2019


On Sat, Jun 1, 2019 at 5:11 AM <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()

Did you look at the exception you get when this runs? It might
possibly be able to point you to the problem, and maybe suggest how
you could resolve it (by importing something, perhaps).

ChrisA



More information about the Python-list mailing list