Skip to content

Instantly share code, notes, and snippets.

Last active May 26, 2020 07:57
Show Gist options
  • Save feerrenrut/73ec3ae46dda87effcb20d6e51a28551 to your computer and use it in GitHub Desktop.
Save feerrenrut/73ec3ae46dda87effcb20d6e51a28551 to your computer and use it in GitHub Desktop.
A braille display driver for NVDA. Braille is displayed on screen. Save this file to the 'brailleDisplayDrivers' folder in your user config (`%appdata%/nvda/brailleDisplayDrivers`) directory or in `source\brailleDisplayDrivers\` directory in your repository.
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2017 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import wx
import gui
import braille
class BrailleViewerFrame(wx.MiniFrame):
def __init__(self):
super(BrailleViewerFrame, self).__init__(gui.mainFrame, wx.ID_ANY, _("NVDA Braille Viewer"), style=wx.CAPTION | wx.RESIZE_BORDER | wx.STAY_ON_TOP)
self.Bind(wx.EVT_CLOSE, self.onClose)
mainSizer = wx.BoxSizer(wx.VERTICAL)
item = self.output = wx.StaticText(self, label=u"\u2800" * NUM_CELLS)
font = item.Font
font.PointSize = 24
item.Font = font
mainSizer.Add(item, proportion=1, flag=wx.EXPAND)
self.Sizer = mainSizer
def onClose(self, evt):
if not evt.CanVeto():
class BrailleDisplayDriver(braille.BrailleDisplayDriver):
name = "brailleViewer"
description = _("Braille viewer")
numCells = NUM_CELLS
def check(cls):
return True
def __init__(self):
super(BrailleDisplayDriver, self).__init__()
if gui.mainFrame:
self._frame = BrailleViewerFrame()
# GUI not initialised yet, so we'll initialise later.
self._frame = None
def display(self, cells):
if not self._frame and gui.mainFrame:
self._frame = BrailleViewerFrame()
if not self._frame:
self._frame.output.Label = u"".join(unichr(0x2800 + cell) for cell in cells)
def terminate(self):
super(BrailleDisplayDriver, self).terminate()
except wx.PyDeadObjectError:
# NVDA's GUI has already terminated.
Copy link

Hello, it would be wonderful if this worked.

I'm using NVDA 2018.1 and it looks like it expects .pyc but not .py files in NVDA\brailleDisplayDrivers.
What do I need to do to make this work with NVDA 2018.1? When I relaunch NVDA, it doesn't see the new driver.


Copy link

Yes, it looks like I didn't write very good instructions. Sorry about that. It should work with an installation of NVDA if you place the file in %appdata%/nvda/brailleDisplayDrivers.

Copy link

smackbrl commented Feb 3, 2019

I am not actually a programmer, but I unzipped the file and put it in NVDA/brailleDisplayDrivers. I can see the file in there in Windows Explorers, but Braille Viewer is not listed when I go into NVDA braille displays. What does the %appdata% part of your directions mean? Thanks!

Copy link

Note: The braille viewer has been integrated with NVDA, find it via the tools menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment