Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer


by Jouke (Curate)
on May 29, 2001 at 15:13 UTC ( #83879=sourcecode: print w/ replies, xml ) Need Help??
Category: GUI Programming
Author/Contact Info Jouke Visser (
Description: pVoice is a speechapplication for disabled people who can't speak themselves. By only generating left and right mousebuttonclicks the whole application can be operated.

update: pVoice has grown so much that it's not possible to keep the code here updated. You can find the sourcecode of pVoice 2.x at Binary releases (packed with ActiveState's PerlApp) can be found on
The current pVoice does no longer use Tk for the GUI, but wxPerl instead

I'll keep the code updated in here, though pVoice 0.01 was posted in Cool Uses for Perl. For more backgroundinfo, look at

This is version 0.02.1
The current version is 2.1
#!/usr/bin/perl -w
# pVoice
# For more information go to where you can
# download a zipfile containing this file, the README and pvoicecommon
# See the mentioned  README file for a little documentation
# Since version 0.02.1 you also need, which is the obj
# package. 

use Tk 800.017;
use Tk::JPEG;

# And on unix-systems it requires the system command 'play' to play th
+e .wav 
# files, and on Win32 systems, it requires Win32::Sound for the same p
# Author:        Jouke Visser
# Last modification:    May 28, 2001
# pVoice is free for personal use.
# Copyright (c) 2001, Jouke Visser
# Changelog:
# 0.01: First release
# 0.02: Little bugfix (arrow-up on first position never showed up)
# 0.02.1: OO-ified the whole thing and parametrisized as much as possi
use strict;

use pvoicecommon;
# Configuration-stuff
my $pv = new pvoicecommon(
            program_title    => "pVoice 0.02.1 development",
            bgcolor        => 'white',
            active_bgcolor    => 'red',
            sounddir    => "./data",
            current_category=> "",
            current_page    => 1,
            indexfile     => "index.txt",
            catfile        => "cat.txt",
            sound_ext    => "wav",
            img_ext        => "jpg",
            border_width    => 10,
            cellpadding    => 4,
            columns        => 4,
            rows        => 4,
            selected_button    => 0
my $img_ext = $pv->img_ext();

# Create the main window
my $main = MainWindow->new(-background => $pv->bgcolor());
# Maximize the window
my ($screenw, $screenh) = ($main->screenwidth, $main->screenheight);

# Write the title of the window

#create the window for the images
$pv->mainframe($main->Frame(-background => $pv->bgcolor())->pack());

# Write the header
$pv->mainframe()->gridRowconfigure(0, -weight => 0, -pad => $pv->cellp
my $label=$main->Label(    -text => $pv->program_title(), 
            -background => $pv->bgcolor());
$label->grid(    -in     => $pv->mainframe(),
        -column => 0,
        -row    => 0,
        -columnspan=> $pv->columns()

# Determine the maximum size of each icon
$main->update(); # To determine the height of the $label the window mu
+st be updated
$pv->max_height(int(    ($main->height() - $label->height())/$pv->rows
            (2*($pv->border_width() + $pv->cellpadding())
$pv->max_width(int(    (($main->width)/$pv->columns())-
            2*($pv->border_width() + $pv->cellpadding())

#configure the grid to constant cellsizes
$pv->configurecolumns(startcolumn => 0);
$pv->configurerows(startrow => 1);

# Read the categoryfile and draw the first page with category-buttons
my @categories = $pv->readcategoryfile();

# Make the first button active 
$pv->buttons()->[$pv->selected_button()]->configure(-state => 'active'

# Right mouseclick means select next item
            sub {
                                -state => 'normal');
                if ($pv->selected_button() < @{$pv->buttons()} -1)
                else    {$pv->selected_button(0)}
                                -state => 'active');

# Left mouseclick means execute current item
        sub {

Replies are listed 'Best First'.
Re: pVoice
by Beatnik (Parson) on May 29, 2001 at 15:58 UTC
    Maybe you could add some Festival bridge, CPAN has a few modules on it.

    I've noticed it can get quite resource consuming... but that goes for any other server I run on my ole P133 :)

    ... Quidquid perl dictum sit, altum viditur.
      I'm working on that already. Only problem with it is the support for Dutch language. At home I have a test running using Festival but it only generates an English male/female voice... and that produces horrible Dutch :)

      Jouke Visser, Perl 'Adept'
      Using Perl to help the disabled: pVoice and pStory
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://83879]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2016-08-28 20:17 GMT
Find Nodes?
    Voting Booth?
    The best thing I ever won in a lottery was:

    Results (395 votes). Check out past polls.