I am doing a program that gives the user attention each 25 min, then gives him 5 min break, everything was well for testing the code with small number of time(less than 2 min) but when I test it in real 25 min ,it gives me this error:
RecursionError: maximum recursion depth exceeded
what I thought that I need to change recursion depth, then I changed it by:
sys.setrecursionlimit(1000000)
then it really exceeded the 2 min but when it reached about 10 min the program just killed!
I guess it is because the program makes a big space of memory or something like that but how can I fix this problem!!?
I will try to give you the main function briefly so you can understand the idea::
sec=1500
count=0
def run():
global sec
global count
m,s=divmod(sec,60)
if sec >=0:
m,s=divmod(sec,60)
lblmin.config(text=str(m).zfill(2))
lblsec.config(text=str(s).zfill(2))
sec -= 1
if sec==-1:
count += 1
if count%2 ==0 : #to know if the timer will do 5 min or 25 min
confstr=messagebox.showinfo("stert?","timer will start now")
if confstr:
sec=1500
else: #for break
runbreak=False
if runbreak == False:
root.attributes("-topmost", True)
ask=messagebox.askyesno("break","break for 5 min")
runbreak=True
if runbreak:
sec=300
root.after(1000,run)
root.mainloop()
maybe (just what I think) it is because of the huge time that lblmin and lblsec are changing, but I really don't have any idea to fix this problem.
please help:(