Asked
Active
Viewed 29 times
-1
-
1Post code and errors as text, not images. – tdelaney Oct 15 '22 at 16:26
-
Look for conditions where setting Take_photo may be skipped. There's your problem. – tdelaney Oct 15 '22 at 16:27
1 Answers
0
Look like you have made a change to the variable Take_photo
in the function. That's why there is the error here.
You can just simply add global Take_photo
and it should work.
Your function should be:
def btn_clicked():
global Take_photo
#your code
You might want to have a look at this answer for more detail https://stackoverflow.com/a/50766668/17990633
Hope it works, have a nice day!

Hung
- 155
- 10
-
I've tried it but the result is different from what I expected, the countdown time stops and doesn't take photos – Mhd Irfan Fajar Nst Oct 15 '22 at 16:36
-
Can you please give the full code, especially the code inside that function? I cannot know your situation yet. – Hung Oct 15 '22 at 16:39
-
Also, if the result is different from what you've expected, there might be some problem in your code algorithm, you may try to scan the whole code again to find the problem. – Hung Oct 15 '22 at 16:42
-
i already change the photo.. actualy i am new using and asking in this stackoverflow..so when i tried to copy my code so many warn that i get – Mhd Irfan Fajar Nst Oct 15 '22 at 16:53
-
actually I have tried this program before and it worked but because I wanted to make the GUI I encountered this error – Mhd Irfan Fajar Nst Oct 15 '22 at 16:57
-