Skip to content

Commit

Permalink
Refactor code to improve typing initiation and remove unnecessary tim…
Browse files Browse the repository at this point in the history
…e delay
  • Loading branch information
LyubomirT committed Jul 26, 2024
1 parent 1f1c9fd commit 632b803
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def start_typing(self):

self.startButton.setEnabled(False)
self.stopButton.setEnabled(True)
time.sleep(delay)
if delay > 0:
QTimer.singleShot(delay * 1000, lambda: self.initiate_typing(text, interval, type_enter, chars_per_stroke))
else:
pass
self.initiate_typing(text, interval, type_enter, chars_per_stroke)

def initiate_typing(self, text, interval, type_enter, chars_per_stroke):
Expand Down

0 comments on commit 632b803

Please sign in to comment.