Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Accessible GUI Applications in Perl

by smiffy (Pilgrim)
on Nov 08, 2008 at 05:45 UTC ( #722367=perlquestion: print w/replies, xml ) Need Help??

smiffy has asked for the wisdom of the Perl Monks concerning the following question:

There are a couple of command-line applications that I use that I have thought of adapting for GUI use. My first thought would be to use the Tk module, but after having a quick read of the documentation on some of the widgets, I see that I have a problem - it does not look like there are any accessibility features.

I would assume that the deficiency comes from Tk itself, rather than the Perl module. After all, Tk has been around a fair while - probably from before the time that anyone might have thought that people would be making use of assistive/adaptive technologies to use their computers.

What I would expect to see in an accessible GUI toolkit would include:

  • The means to make the application fully keyboard-navigable.
  • The ability of the entire application to work with assistive/adaptive technologies such as screen readers, Braille displays, etcetera.
  • Some form of tooltips.
  • Cross-platform operation.

(That last point isn't something that everyone in the accessibility community would agree on, but I do.)

There are a number of ways I can approach this:

  • Forget having a GUI, stick with the command line. I have one blind associate who does just about everything through EMACS, voiced with EMACSpeak; he tells me that command line applications are the best. (For him at any rate.)
  • Convert the applications to client/server - have the Perl application running on a network socket, write the GUI client in another language beginning with J that has a full accessibility API. (Not favoured, don't really want to run client/server, don't really want to write in the 'J' language with the GUI that sounds like something kids play on.)
  • Convert the applications to web applications. (Not favoured, similar reasons to the above.)
  • Use another GUI toolkit of which I am unaware for which there is a Perl module and accessibility features.

So, my question is this - can anyone recommend an alternative GUI toolkit which is geared up for writing accessible applications, that will run cross-platform and - perhaps most importantly - isn't a pig to learn?

Or should I just stick with the command line?

Replies are listed 'Best First'.
Re: Accessible GUI Applications in Perl
by szabgab (Priest) on Nov 08, 2008 at 13:32 UTC
    The Anonymous Monk has already mentioned pVoice which is the classic example of GUI written in Perl (wxWidgets in this case) and with a lot of love, caters to some kind of disability.

    It is probably not the same accessibility issue you are facing but to ignorants like me they seem to be related.

    I have been using wxPerl for some time now to build Padre an IDE for Perl. As a off-shot from that project I started to create a library to make it easy to add GUI to existing command line scripts.

    Writing a real GUI application is very different from a command line application as the former is event driven. The module I wanted to create would help overcome the difficulty for the simple cases. It is in very early stages and I have not addressed any accessibility issues but I'd be glad if you checked out Wx::Perl::Dialog::Simple in Wx::Perl::Dialog and helped me in turning it into something that is really useful for such applications.

    To address the four issues you raised

    • Fully keyboard-navigable - this is up to the developer I think, You can do it with wxPerl
    • The ability to work with assistive/adaptive technologies. - This is the area where I have no experience at all, but I'd love to get feedback on this.
    • Tooltips are available.
    • Cross-platform operation: Windows and Linux work quite well (after some installation troubles). I think OSX too, but I heard slightly more trouble there.

      OK, you've convinced me - Wx::Perl is worthy of investigation. I've just had a look at the WxWidgets site and it appears that accessibility is something that is being worked on.

      Even if it's not there are the moment, the issue is being acknowledged and addressed which gives me hope that this could be the path for future accessible Perl GUI applications. (That is assuming that the Perl module is sufficiently transparent, but I'm sure that this could be fixed easily enough if it were not.)

      I am now wondering about Tk again; further research has shown that Tk is MSAA-compliant, so accessibility has been addressed in the underlying toolkit. Whether the Perl Tk module is missing implementation of methods or if mention is simply missing from the man pages is something I'll have to investigate when I get the time.

      I will, however, be looking at Wx in the first instance as the underlying project looks to be more 'fresh' than Tk.

Re: Accessible GUI Applications in Perl
by zentara (Archbishop) on Nov 08, 2008 at 14:42 UTC
    Gtk2 has Accessilibility features. The problem is you usually need a distro that is setup to use it, the Xserver must be setup right, etc.

    Try Ubuntu and it's Accessibility setup. Google for "Ubuntu accessibility'. Once you get it setup, you can write Perl/Gtk2 GUI's that will use the accessiblity features. Ubuntu leans toward Python/Gtk2, but the Perl/Gtk2 will work fine, since Ubuntu relies on Gtk2-based Gnome.

    Ubuntu is very easy to setup, and has a LiveCD capability so you can try it out without installing.

    I'm not really a human, but I play one on earth Remember How Lucky You Are

      I think that it's Gnome that give Ubuntu its accessibility functionality; there's a KDE accessibility project too - don't know if it's as advanced as the Gnome one. But that's really all academic for me as you can take Fluxbox out of my cold, dead hands ;-)

      As far as this discussion goes, I would tend to steer clear of GTK. In the nearly 8 years that I've been running Linux on the destkop, I have seen far too many problems with applications not installing correctly due to various GTK dependencies. This doesn't give me a lot of confidence for developing cross-platform applications. There is GTK for Windows, but I'd be inclined to wait for it all to be more mature and mainstream before I considered it as a front-end for cross-platform Perl apps.

        I would tend to steer clear of GTK. In the nearly 8 years that I've been running Linux on the destkop, I have seen far too many problems with applications not installing correctly due to various GTK dependencies.

        That may be true of Gnome2 apps, which is a complex layer on top of Gtk2. I try to avoid Gnome2 apps myself.

        But plain Gtk2 apps are quite easy to install, and Perl/Gtk2 only need the most basic libs....Cairo, Pango, Glib, and Gtk2, and they install easily on linux. You may have problems, if you don't set the prefix right in the compile options, and you get multiple lib sets, or overwrite a lib needed by some app compiled for you by the distribution's authors.

        But if you don't use rpms, and precompiled packages, and compile all your Gtk2 apps yourself, there are very few problems. The only exception is Gtk2 on MS Windows.....that still is pretty bad. The only version available is out-of-date, and won't work with Perl 5.10.

        As the number of libs needed by systems increase and become increasingly intertwined, something like Ubuntu is looking good. I, like you, prefer my ICEWM on Slackware, which is almost twice as fast loading and running than Ubuntu; but I really am impressed with the Synaptics package manager, for keeping you up to date, and installing pre-requisite libs when you want an app. For the average computer user out there, who dosn't want to deal with maintaining their own libs, Ubuntu is very good.

        Also since Gtk2 has a theme manager, in ~.gtkrc-2.0, you can set large default fonts, and high contrast color themes, which would be enough for most people. Accessibility can mean many things to different people, poor vision, deaf, blind, no limbs, etc.

        I'm not really a human, but I play one on earth Remember How Lucky You Are
        I was just trying out the latest Ubuntu 8.10, named Intrepid, and you might be surprised, I was. They seem to have a new ( to me anyways) option under Applications called Universal Access, and it runs something called the Orca Screen Reader and Magnifier. It uses the Flite style voice to read whatever you position your mouse over, thru the soundcard. There are alot of options, and I only briefly tested it. If used in conjunction with the "High Contrast Large Print Inverse" theme, it is pretty handicap friendly.

        You might want to check it out.

        I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: Accessible GUI Applications in Perl
by Anonymous Monk on Nov 08, 2008 at 11:59 UTC

      I know that it's heresy to say so here but yes, Java/Swing certainly has everything that is required for the development of accessible applications. I wrote a small GUI application with Java/Swing a couple of years back - it certainly had all the accessibility "bits" that I might have wanted.

      The main reason that I tend to steer clear of Java for most purposes is that I have never been comfortable with OO programming - my mind simply doesn't work that way. And that's the joy of Perl - you can write functional or OO, whichever takes your fancy.

Re: Accessible GUI Applications in Perl
by Anonymous Monk on Nov 09, 2008 at 08:02 UTC
    For creating accessible GUIs with perl there are 2 modules that can be used: Win32::GUI and WxPerl. Tk-based GUIs are not accessible at all and Gtk2 are not accessible at least under Windows. Win32::GUI can be used only under Windows, while WxPerl is portable and it offers many more features: more widgets and the possibility to use UTF-8. The most important WxPerl widgets are very accessible for Jaws and I guess for other screen readers also, because just as Win32::GUI and Java SWT, WxPerl uses the native widgets of the OS. Java SWING GUIs can be made accessible if using Java Access Bridge, but the accessibility in that case is poor, so SWING is not recommended. I've made a dictionary using WxPerl that you can download and test and its source code is also available at: (I developed it while learning WxPerl, so some methods might not be the best ones.)

      Thanks for this valuable insight. You have confirmed for me that Wx is probably the right Perl/GUI route for me to pursue. If it works with JAWS on Windows, it certainly should work with other ATs, as they would all be using the same MS accessibility API.

      I am very interested to that Java/SWING isn't as accessible as is perhaps made out. It would be so nice if it transpired that it was easier to code accessible GUI applications in Perl than in Java. (Market penetration would still be an issue - most computers ship with a JVM, but I haven't seen too many non-UNIX systems that ship with Perl :-(

        If you are talking about Windows machines then talk to Adam Kennedy and tell him you want Portable Chocolate Perl now!

        That should already include Wx out of the box so it will be easy to add you application. Then you zip it up again and distribute that to your clients.

Re: Accessible GUI Applications in Perl
by Jouke (Curate) on Jun 30, 2009 at 22:53 UTC
    Hi, After a long absence from the active online Perl community, I'm in the middle of reading up on a couple of year's worth of messages, websites and mailinglists :) The pVoice project that has been kindly mentioned by others is my pet project. I must admit however that if pVoice was my pet, I have neglected it for so long that it would have died a horrible death by now. Luckily, pVoice is just a piece of software, which can be revived pretty easily, which (again) I'm currently trying. Now, to get back at your question: The reference to pVoice -how flattering it may be for me- to me seems inappropriate. From what I read, your focus is on people with a vision impairment, that need screen readers. If not, I think you first need to define the intended audience of your application. If your focus is indeed on the vision impaired, I must agree with your associate that command line rules, as that's the most accessible for braille displays and screen readers. If you aim at using stuff like text to speech, or if you have some other intention, sure, you can use a GUI for nice looks. My personal preference would be wxPerl, but that's really up to you. I hope my (late) reply is of some help to you. Cheers,

    Jouke Visser
    Using Perl to enable the disabled: pVoice

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://722367]
Front-paged by almut
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2023-11-28 14:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found