0
def cdvalue():
    cd = cd - 1

def Cd():
    root.after(1000, cdvalue)

I want to subtract one from "cd" variable every time the function activates. How can I do that?

1 Answers1

1
def cdvalue():
    global cd
    cd = cd - 1

def Cd():
    root.after(1000, cdvalue)

If that's not what you want to achieve or you wanna use the fact that functions are objects in python, check out this Access a function variable outside the function without using "global"

Zerox
  • 290
  • 4
  • 18