Problems in using python tkinter
Question: Initially running the code, blinking will start row wise. What my software
should do is that if the user gives the input "1" in the last row textarea,the
blinking should start column wise.

Again if the user give the input "1" then the letter should be selected and
should be displayed on the top textarea and entire process should start again
I am not able to control the while loop when the user gives the input in the
last row textarea.

I am beginner in python tkinter and I am not able to do what I want exactly.

Thanking You in advance

    
    
    # your code goes here
    import Tkinter
    from  Tkinter import *
    import tkMessageBox
    
    top = Tkinter.Tk()
    
    content=0
    
    def helloCallBack1():
       tkMessageBox.showinfo( "Hello Python", "Hello World")
    
    L1 = Label(top, text="Your Text Appears Here")
    L1.grid(columnspan=10)
    E1 = Entry(top, bd =5,width=40)
    E1.grid(columnspan=10)
    
    a1 = Tkinter.Button(top, text ="WATER",width="10", command = helloCallBack1)
    a1.grid(row=4,column=0)
    B = Tkinter.Button(top, text ="B", command = helloCallBack1)
    B.grid(row=4,column=1)
    C = Tkinter.Button(top, text ="C",command = helloCallBack1)
    C.grid(row=4,column=2)
    D = Tkinter.Button(top, text ="D", command = helloCallBack1)
    D.grid(row=4,column=3)
    E = Tkinter.Button(top, text ="E", command = helloCallBack1)
    E.grid(row=4,column=4)
    F = Tkinter.Button(top, text ="F", command = helloCallBack1)
    F.grid(row=4,column=5)
    
    row1 = Tkinter.Button(top, text =" ", command = helloCallBack1)
    row1.grid(row=4,column=6)
    
    a1 = Tkinter.Button(top, text ="ALARM",width="10",bg="red", command = helloCallBack1)
    a1.grid(row=5,column=0)
    H = Tkinter.Button(top, text ="H", command = helloCallBack1)
    H.grid(row=5,column=1)
    I = Tkinter.Button(top, text ="I", command = helloCallBack1)
    I.grid(row=5,column=2)
    J = Tkinter.Button(top, text ="J", command = helloCallBack1)
    J.grid(row=5,column=3)
    K = Tkinter.Button(top, text ="K", command = helloCallBack1)
    K.grid(row=5,column=4)
    L = Tkinter.Button(top, text ="L", command = helloCallBack1)
    L.grid(row=5,column=5)
    
    row2 = Tkinter.Button(top, text =" ", command = helloCallBack1)
    row2.grid(row=5,column=6)
    
    a1 = Tkinter.Button(top, text ="FOOD",width="10", command = helloCallBack1)
    a1.grid(row=6,column=0)
    
    N = Tkinter.Button(top, text ="N", command = helloCallBack1)
    N.grid(row=6,column=1)
    O = Tkinter.Button(top, text ="O",command = helloCallBack1)
    O.grid(row=6,column=2)
    P = Tkinter.Button(top, text ="P", command = helloCallBack1)
    P.grid(row=6,column=3)
    Q = Tkinter.Button(top, text ="Q",command = helloCallBack1)
    Q.grid(row=6,column=4)
    R = Tkinter.Button(top, text ="R", command = helloCallBack1)
    R.grid(row=6,column=5)
    
    row3 = Tkinter.Button(top, text =" ", command = helloCallBack1)
    row3.grid(row=6,column=6)
    
    a4 = Tkinter.Button(top, text ="BACKSPACE",width="10", command = helloCallBack1)
    a4.grid(row=7,column=0)
    S = Tkinter.Button(top, text ="S", command = helloCallBack1)
    S.grid(row=7,column=1)
    T = Tkinter.Button(top, text ="T", command = helloCallBack1)
    T.grid(row=7,column=2)
    U = Tkinter.Button(top, text ="U", command = helloCallBack1)
    U.grid(row=7,column=3)
    V = Tkinter.Button(top, text ="V", command = helloCallBack1)
    V.grid(row=7,column=4)
    W = Tkinter.Button(top, text ="W", command = helloCallBack1)
    W.grid(row=7,column=5)
    
    
    row4 = Tkinter.Button(top, text =" ", command = helloCallBack1)
    row4.grid(row=7,column=6)
    
    L2 = Label(top, text="Press 1 when you want to select")
    L2.grid(columnspan=10)
    E2 = Entry(top, bd =5,width=40)
    
    E2.grid(columnspan=10)
    
    content = E2.get()
    
    content=0;
    
    i=0;j=0;
    while(i<30):
    
        row1.after(4000*j+1000*i, lambda: row1.config(fg="red",bg="black"))
        row1.after(4000*j+1000*(i+1), lambda: row1.config(fg="grey",bg=top["bg"]))
        row2.after(4000*j+1000*(i+1), lambda: row2.config(fg="red",bg="black"))
        row2.after(4000*j+1000*(i+2), lambda: row2.config(fg="grey",bg=top["bg"]))
        row3.after(4000*j+1000*(i+2), lambda: row3.config(fg="red",bg="black"))
        row3.after(4000*j+1000*(i+3), lambda: row3.config(fg="grey",bg=top["bg"]))
    
        row4.after(4000*j+1000*(i+3), lambda: row4.config(fg="red",bg="black"))
        row4.after(4000*j+1000*(i+4), lambda: row4.config(fg="grey",bg=top["bg"]))
    
        content=E2.get()
        if content==1:#this is not working
            break
    
        i=i+1
        j=j+1
    
    top.mainloop()
    


Answer: The problem is that your while loop runs in like a blink of an eye, and you
cant input anything meanwhile. Because of the `after` calls the blinking
persist, but that does not mean you are still in your wile loop. The program
exited that loop long when you input something into the box.

What i would do is to bind the entry box to a key (like Return) and when the
key is pressed check the content of the entry box, and if it is 1 then stop
the blinking.

Also you can just bind this whole stuff to the `1` key, and avoid the whole
Entry widget stuff

