I am creating an app "pdf text to speech" and it works fine.
When I press "convert" I want this group box to run in a separate thread displaying the progress (the progress bar is inside a group box) and the current page. How can I do this? This is the function I am using to convert text to speech:
def convert_clicked(self):
self.start = int(self.lineEdit_5.text()) #start reading
self.end = int(self.lineEdit_8.text())
speaker = pyttsx3.init()
speaker.setProperty("rate", 140)
for i in range(self.start-1, self.end+1):
page = self.pdfreader.getPage(i)
text = page.extractText()
speaker.runAndWait()
speaker.save_to_file(text, f'{self.save_path}\\page {i+1}.mp3')
self.book.close()
