Apr-07-2018, 11:11 PM
Quote:What do you think that's doing?def exit(): exit()
You defined a function, that calls itself. And when it runs, it calls itself. Again and again, forever.
For the other error, I'm not sure what line that is, since the lines are different now. But it kinda looks like this:
Quote:def stopClick(): if startClickingVar == 1:
A function is like a black box. You pass it arguments, it does something with them, then it hands you back a response. Your black box doesn't have any arguments, but it's trying to do something with something it doesn't have. Python is smart enough to look at the rest of the function to try to figure out what you're doing, and it's "helping" by letting you know that you defined the variable later on in the function, which means it's currently "unbound" (because it doesn't exist), but you eventually define it later (referenced before assignment):
UnboundLocalError: local variable 'startClickingVar' referenced before assignment
.However, because you're using global variables, that doesn't actually help, either. Because you're not using it like a local variable, you're using a global. Python's error isn't going to help much with that, because it isn't something you should be doing, lol.
You have a comment,
#global var
. That would be the place to define your global startClickingVar
. Then, in this function, the very first line should be a note to Python that it should go looking for the variable somewhere else, as that function doesn't need to define it: def stopClick(): global startClickingVar if startClickingVar == 1: