To change the accent of the voice, you can use the pyttsx3.setProperty('voice', 'en-us')
code.
It does not do much ...
But here is the complete code anyway
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.setProperty('voice', 'en-us')
engine.say("Hello World!")
engine.runAndWait()
engine.stop()
or
as mentioned in the other answer you can use a for loop to loop through all the different accents ...
As shown in the code below
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
print(voice, voice.id)
engine.setProperty('voice', voice.id)
engine.say("Hello World!")
engine.runAndWait()