Here's a quick post on how to install Accessible_output2, and how to use it from Python 3.4. I'm writing this since I didn't find any tutorials when I did a quick web search. As with all things technology, by the time you read this, it may be out of date, so I'm sorry about that. Note that I am not the author of Accessible_output2, and take no responsibility beyond this tutorial.
What is Accessible_output2
Accessible_output2 is a Python package that allows you to quickly speak messages to a user using synthesized speech. It seems to be cross-platform, however I've only used it on Windows. It's nice because it can use the already-running screen reader on the system, so your users don't have to configure the settings of yet another speech system. If there is no running screen reader, it falls back to Microsoft Speech API (SAPI) on Windows.
Here are the prerequisites that I had to install to get Accessible_output2 running on my system. I've only really used it with NVDA and SAPI, but from what I can tell, Jaws and the other screen readers should work if you have them installed.
Since this tutorial is on how to use it from Python 3.4, having it installed is a must. When I install Python, I get it from the main Python site. Realistically, there's no reason to get a 64-bit version of python, unless you know you absolutely must, so when in doubt, go with the 32-bit version. That applies even if you are on a 64-bit version of Windows. At the time of writing, the latest version is Python 3.4.3.
The next requirement is PyWin32. The best place that I've been able to find it is on SourceForge.
The next two requirements are custom packages that the author of Accessible_output2 has developed. You can find Platform_utils on the author's Mercurial site. You will have to install it by downloading it, unzipping it, and running setup.py with the install command line argument:
python setup.py install
The final requirement is Libloader. Just as the previous one, this package can be found on the author's Mercurial site, and requires you to run setup.py with the
install command line parameter once you unzip it.
After installing the requirements, you can finally install Accessible_output2. You can find the latest version on the same Mercurial site, and you have to install it using the now familiar setup.py once you unzip it.
Assuming that things have gone to plan, you can now use Accessible_output2. Below is a sample python session that will speak the text "Hello, World!" using SAPI.
# Import the package import accessible_output2 as ao2 # List the screen readers that accessible_output2 can work with. # Note that just because a screen reader is in this list, it does not mean that the user has it installed. ao2.get\_output\_classes() # Create an instance of a class using the SAPI output class. # Note that it is item 6 on my system, but I'm not sure if it will be the same on yours. sapi = ao2.get\_output\_classes()() # List the methods and other attributes of the output class. # The dir() function is a Python programmer's best friend. dir(sapi) # Speak the text "Hello, World!" using SAPI: sapi.speak("Hello, World!")
And there you have it. There are a lot of other useful commands, such as
set\_rate() that the
dir() function will show. You can play with them using SAPI, since SAPI is installed by default on any modern version of Windows.