How to Stop a Program Until a Specific Action Happens
<p>Using python and tkinter, is there a way I can run a part of the program, then stop it until the user clicks a specific button and then continue running?</p>

<p>I mean:</p>

<p>function - stop - click button - continue running.</p>

<p>Necessary code for this:</p>

<pre><code>def yellowClick():

    yellow.configure(activebackground="yellow3")
    yellow.after(500, lambda: yellow.configure(activebackground="yellow"))

yellow = Tkinter.Button(base, bd="0", highlightthickness="0",
                       width="7", height="5", activebackground="yellow",  
                       bg="yellow3", command = yellowClick)

yellow.place(x = 30, y = 50)


def blueClick():

    blue.configure(activebackground="medium blue")
    blue.after(500, lambda: blue.configure(activebackground="blue"))

blue = Tkinter.Button(base, bd="0", highlightthickness="0",
                     width="7", height="5", activebackground="blue",
                     bg="medium blue", command = blueClick)

blue.place(x = 125, y = 50)


def redClick():

    red.configure(activebackground="red3")
    red.after(500, lambda: red.configure(activebackground="red"))

red = Tkinter.Button(base, bd="0", highlightthickness="0",
                    width="7", height="5", activebackground="red",
                    bg = "red3", command = redClick)    

red.place(x = 30, y = 145)


def greenClick():

    green.configure(activebackground="dark green")
    green.after(500, lambda: green.configure(activebackground="green4"))

green = Tkinter.Button(base, bd="0", highlightthickness="0",
                      width="7", height="5", activebackground="green4",
                      bg="dark green", command = greenClick)

green.place(x = 125, y = 145)

def showSequence():

    r = random.randint(1, 4)

    if r == 1:

        yellow.configure(bg="yellow")
        yellow.after(1000, lambda: yellow.configure(bg="yellow3"))

    elif r == 2:

        blue.configure(bg="blue")
        blue.after(1000, lambda: blue.configure(bg="medium blue"))  

    elif r == 3:

        red.configure(bg="red")
        red.after(1000, lambda: red.configure(bg="red3"))   

    elif r == 4:

        green.configure(bg="green4")
        green.after(1000, lambda: green.configure(bg="dark green")) 
</code></pre>

<p>This is for a simon game, I need to run this function once, then make it stop until the player clicks a button and then return to this function.This is for the first turn. I need to connect the showsequence function in a way that it stops until a button is clicked but I don't know how.</p>

<p>Stoping the program by time will not work in this, I mean wait for a specific action to happen.</p>

<p>have a look at this code sample.  it works as is, copy/past it and it will run.  There is no loop.  It waits for the button click.   I think you could initialize the program by loading a random pattern of colors into the "answers" list which could essentially be your levels.<br>
<a href="http://stackoverflow.com/a/14772550/2601293">make TK inter wait for user input</a></p>

python tkinter