#!/usr/bin/perl -w # muppet # This simple bit of code has helped my toddlers learn letters and # numbers for quite some time. I thought i should share it, if for # nothing else than the line where i set the font size. :-) # zentara # Version 2 ... the keyboard trainer....free for all who purchased # Version 1 within the last year :-) use strict; use Gtk2 -init; my $window = Gtk2::Window->new; $window->set_size_request(800,300); $window->set_position('center'); my $label = Gtk2::Label->new ("W"); my $font_desc = Gtk2::Pango::FontDescription->from_string ("Sans Bold"); $font_desc->set_size (100000); $label->modify_font ($font_desc); $window->add ($label); $window->signal_connect (key_release_event => \&keyrelease); $window->signal_connect (destroy => sub { Gtk2->main_quit }); $window->show_all; Gtk2->main; sub keyrelease { my ($widget, $event) = @_; my $key = Gtk2::Gdk->keyval_name ($event->keyval); if( $key =~ /^(Alt|Multi|Control|Shift)/ ){ return } $key =~ tr/_/ /; my $ukey = uc($key); $label->set_text ($ukey); #added by zentara Gtk2->main_iteration while Gtk2->events_pending; system('flite', '-t', "$key"); } __END__