This may be a fairly noob-ish question but it is a problem I have ran into before and can't seem to fathom a way around.
in this instance, I am writing a small game and I need to increment two variables, all of which will be apparent in the code, but no matter what I do, I keep getting a 'variable referenced before assignment' error. this happens even though I have globally declared the variables before I try to reference them.
may apologies if this problem has a simple solution but any and all advise is appreciated.
here is the code:
global level, score
level = 0
score = -1
def play():
    level += 1
    score = (score + level)
    game()
    return
def close():
    win.destroy()
    return
def green():
    return
def red():
    return
def yellow():
    return
def blue():
    return
def game():
    levelBox.delete(1,END)
    scoreBox.delete(1,END)
    levelBox.insert(1, level)
    scoreBox.insert(1, score)
    win.after(2000, play)
    return
additional information:
- the program uses a Tkinter interface 
- the colour functions have no use yet 
- I have already tried where the variables are declared 
- the 'win.after' function can't assign arguments to the function it calls 
 
    