Skip to the content.

Blind User Interface - the interface you can design with your eyes closed

Blind User Interface (BUI) is meant to be a simple toolkit to design user interfaces with a Pythonic syntax. Having been created by a blind user, it gives a lot of importance to accessibility and compatibility with screen readers, while offering a comfortable user interface that anyone can use. However, this restriction doesn’t imply you cannot (and should not) create complex or really beautiful user interfaces with BUI. You should and you can. You might consider helping this project, however, to help create more elaborate interfaces should the need arise.

BUI relies on several core principles:

These simple concepts make for an interesting (and inovative, to some extent) approach to creating interfaces with BUI.

Installation

To install BUI, you should simply run pip:

pip install bui

BUI is currently supported on Windows and will install wxPython. Other toolkits and platforms will be supported with some help and time.

Brief example

Here is a basic usage of BUI. This example is briefly explained just below. To test this script, place it in any file and run it with Python, having installed BUI and a supported GUI toolkit:

from bui import Window, start

class HelloBUI(Window):

    """Class to represent a basic hello world window."""

    layout = mark("""
      <window title="A BUI demonstration">
        <menubar>
          <menu name="File">
            <item>What is it?</item>
            <item>Quit</item>
          </menu>
        </menubar>

        <button x=2 y=2>Click me!</button>
        <text x=3 y=3 id=report>Report</text>
      </window>
    """)

    def on_click_me(self):
        """When the 'Click me!' button is pressed."""
        self["report"].value = "The button was clicked!"

    def on_quit(self):
        """When the user press the quit menu item in the File menu."""
        self.close()

    # Keyboard shortcuts
    def on_press_alt_f4(self):
        """When the user presses Alt + F4."""
        self.close()

    # Linking an alias to a method is so simple
    on_press_ctrl_q = on_press_alt_f4


start(HelloBUI)

That’s it. This little code will generate a window with:

  1. A menu bar, containing only one menu (File) with different menu items.
  2. A button in the center of the window, called “Click me!”.
  3. A text field below and to the right of this button where the text will be updated when the button is clicked.

In terms of code, here is what we do:

Notice that most of the code is actually used by our window layout. You can (and maybe should) place the HTML window layout in a separate file, so that designers can edit it wihout seeing and worrying about your code. On your side, you don’t really need to know how the window is designed, as long as you know the controls to interact with users.

Documentation

BUI’s documentation can be found here, or in the docs folder in the repository itself :

License

Blind User Interface is available under the terms of the BSD Public License (v3). In short, you can use this code for whatever reason, provided you keep the copyright identifying this code as from BUI. Apart from that, you can use this code for whatever purpose, including to design commercial software. You can find the full terms by reading the LICENSE file.