Re: How to create/render a relatively usable/accessible GUI in python?

  • From: Q <q@xxxxxxxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 25 Aug 2011 13:47:28 -0400

This. I work on gui_components, a pythonic wrapper to WX.
usage like:
import wx
from gui_components.sized import SizedFrame
from gui_components.menu import Menu, MenuBar, MenuItem

class SomeWindow(SizedFrame):

 def __init__(self, title="Something", *args, **kwargs):
  super(SomeWindow, self).__init__(title=title, *args, **kwargs)
  self.MenuBar = MenuBar(
   Menu("&File",
    MenuItem('&Open...', hotkey='ctrl+o', callback=handle_open_function),
    None, #A menu separator
    MenuItem('&Save', hotkey='ctrl+s', callback=handle_save_function),
   ),
  )
self.random_text_field = self.labeled_control("Random text", wx.TextCtrl, value="Hi there!") self.some_button = self.labeled_control("I'm a button!", wx.Button, callback=handle_button_click)
  self.finish_setup()

As you can see, it's dramatically simpler than original WX. No creating labels, then creating controls, then binding controls to event types. Events are automatically skipped (the most common action when processing them), though you can pass skip_event=False to the labeled_control (or create_control) methods. The Menu bar is loads simpler than generic WX, and quite useful. you can go, for instance, self.menubar.file.open.Disable() And the finish_setup call makes the window so it can't be shrunk smaller than the controls in it, as well as setting initial focus to the first really-focusable control in the window. I use this library in most of my projects and am continuously improving it. It, like most of my stuff, isn't exactly documented, but the code is clear-enough.
gui_components is available at:
http://hg.qwitter-client.net/gui_components




On 8/25/2011 10:06 AM, Littlefield, Tyler wrote:
I would forget LBC. I couldn't manage to get it working, and wxPython has some amazing sizers and other tools for managing window layout. There is also a gui_library or something that Q wrote that wraps some of wxPython's functionality. I'm not sure if it's open for public, but if so, that might help you quite a lot.

On 8/25/2011 8:01 AM, Alex Hall wrote:
TKinter isn't accessible, at least not on Windows. I would use
WXPython (www.wxpython.org). On Windows, Jamal's LBC module is
incredible (www.empowermentzone.com/pylbc.zip) but I'm not sure if it
is cross-platform. I seem to remember it relying on win32 libraries,
so maybe not. Still, the concepts should get you started.

On 8/25/11, Jacob Kruger<jacobk@xxxxxxxxxxxxxx>  wrote:
Ok, am quite happy/comfortable with the command line interface have been
making use of in python, and do also have quite a bit of GUI/interface
specific information with regard to symbian python, but also just wondering
if anyone has ideas of how to render something like a simple button,
textbox, listbox, etc. interface in python that will work across platforms?

For example, while it seems like Tkinter is the primarily used module for
rendering GUI's, I have now started going through introductory tutorial
material, and thus far, things like buttons etc. don't get recognised by jaws or NVDA as such - unless that's because haven't gotten to the point where they really get 'tweaked' too much as of yet, but, still, since don't want to carry on trying too much with this if I won't be able to actually
make use of this aspect of interface implementation/development?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind






__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: