Skip to main content

The Blind User Interface: the interface you can design with your eyes closed.

Project description

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:

  • An interface should not break or require any change in code when porting to a new platform. Thus, BUI is compatible at least with Linux, Mac OS X and Windows platforms.
  • A GUI toolkit perfectly accessible on Windows might break accessibility on Linux or Mac OS X. Therefore, BUI might choose a different toolkit depending on the user's environment, with the developer's permission.
  • Design and control should be separated: no more code to create interfaces should be necessary. Designing beautiful interfaces is, after all, a work for the designers, not for the developers. Developers should focus on the user interactions (that is, how to handle a mouse press on this button, or what to do if some text is typed in this field).
  • A graphical user interface should be easy to test (in unittests for instance). The stability of the user interface should be a core concern of the developer.

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

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.

You will find more explanation in the documentation or by browsing through the examples.

Documentation

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bui-0.3.4.tar.gz (89.7 kB view details)

Uploaded Source

File details

Details for the file bui-0.3.4.tar.gz.

File metadata

  • Download URL: bui-0.3.4.tar.gz
  • Upload date:
  • Size: 89.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for bui-0.3.4.tar.gz
Algorithm Hash digest
SHA256 f0d1b29754cff84890affbd5d28c103003d300ea5b877af36130928f131fd66a
MD5 1a778fe66f2cd1168894399ba3337950
BLAKE2b-256 e81bd8879b96e73b6d2314fc56a0b4159820ead206443866872328a8a2b39c1e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page