dimanche 8 mai 2016

The random choice for a word from a list doesn't word properly (Python/Tkinter)

Hello i'm working on a work on a color stroop, I can change the word and the color of the word with my code, but I can't change only the word when my function "next_selected" is called, can someone help me please ?

def tick():
    global doTick
    global sec
    if not doTick:
        return
    sec += 0.1
    sec = round(sec, 1)
    ftest1.after(100, tick)
    time2Label.configure(text=sec)
    if sec == 60.0:
        doTick = False
        time2Label.config(text=sec)
        label1.config(text=score, fg='black')

def start():
    global doTick
    doTick = True
    label1.pack()
    tick()
    startbutton1.destroy()

COLORS = ['blue','green','yellow','red']

def stimulus(same):

    global word
    colors = list(COLORS)

    if same:
        return (word)

    colors.remove(word)

    return (word)

def next_selected():
    global word
    word = stimulus(choice((True,False)))

    label1.config(text=word)
    label1.update()




Aucun commentaire:

Enregistrer un commentaire