[BlindMath] Scanning braille for sight reading

Łukasz Grabowski graboluk at gmail.com
Mon Jul 31 22:28:37 UTC 2017


The instructions should have been:

the keys s d f j k l are mapped to dots 1 2 3 4 5 6, and when you press
space then the current Braille symbol is written to the file test.txt.
Pressing for example s twice cancels the dot number 1. To exit the
program press x. 

The Braille symbols are written as unicode (e.g. ⠟ ⠇⠓ ⠇⠏ etc.) , so a
sighted person will be able to read it if you send the file test.txt
to them or simply copy the content of test.txt to an email.

Best,
Lukasz

On Mon, 31 Jul 2017 23:11:10 +0100
Łukasz Grabowski <graboluk at gmail.com> wrote:

> John, I wrote this program for you :-)
> 
> Save the script below as say dotbr.py and run it with the following
> command:
> python3 dotbr.py
> 
> the keys s d f j k l are mapped to dots 1 2 3 4 5 6, and when you
> press space then the current dot is written to the file test.txt.
> Pressing for example s twice cancels the dot. To exit the program
> press x. If you want I can add a command line option to save in a
> custom file - it's not a problem but didn't want to spend time on it
> without knowing if you will actually use it.
> 
> I'll send it to you as an attachment as well (not sure if attachments
> are allowed on this mailing list)
> 
> Best,
> Lukasz
> 
> # start of script
> import sys, tty, termios
> 
> def getch():
>     fd = sys.stdin.fileno()
>     old_settings = termios.tcgetattr(fd)
>     try:
>         tty.setraw(fd)
>         ch = sys.stdin.read(1)
>     finally:
>         termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
>     return ch
> 
> last_key=''
> last_br = []
> tr = {'s':1, 'd':2, 'f':4, 'j':8,'k':16,'l':32}
> 
> while not last_key == 'x':
>     last_key = getch()
>     if last_key in tr and tr[last_key] in last_br: 
>         last_br =[x for x in last_br if not x == tr[last_key]]
>     elif last_key in tr:
>         last_br.append(tr[last_key])
>     if last_key == " ":
>         result =10240 + sum(last_br)
>         with open("test.txt", "a") as myfile:
>             myfile.write(chr(result))
>         print(chr(result))
>         last_br = []
> 
> # end of script





More information about the BlindMath mailing list