Tkinter ignores root.after
The countdown animation plays but it ignores the delay and does everything that's after root.after
before the countdown is over
All tests suggest that the countdown is happening and the variable is changing, it just skips the delay
def StartTheSpam():
global TimeLable, ErrorLabel
#destoryes error labels and the countdown timer
try:
for child in root.winfo_children():
if child == TimeLable or child == ErrorLabel:
child.destroy()
except NameError:
pass
#needed for fail-safe 1
mouse = MouseController()
countdown_value = 5
counter = tk.StringVar()
counter.set(countdown_value)
TimeLable = tk.Label(frame, textvariable=counter, padx=10, pady=5, bg=Modes[mode.get()][3]['background'], fg=Modes[mode.get()][2]['text'])
TimeLable.pack()
#coundown
for countdown in range(1, countdown_value):
root.after(1000 * countdown, counter.set, countdown_value - countdown)
x = 100
y = 100
try:
with open(PreferencesStorage['FilePath'], 'r') as SpamText:
while PreferencesStorage['loop']:
for word in SpamText:
#fail safe 1
if x < 21 and y < 21:
break
TempX, TempY = mouse.position
x = int(TempX)
y = int(TempY)
#fail-safe 2
if keyboard.is_pressed('ctrl+d'):
break
keyboard.write(word)
print(word)
#return to begining when at end, thats why its outside of the loop
SpamText.seek(0)
for word in SpamText:
keyboard.write(word)
except FileNotFoundError:
NoFile = tk.Label(frame, text = 'Please Select A File', padx=10, pady=5, fg=Modes[mode.get()][2]['text'], bg=Modes[mode.get()][3]['background'])
NoFile.pack()