Simple edutainment with gtk+ and perl
- From: muppet <scott asofyet org>
- To: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Simple edutainment with gtk+ and perl
- Date: Sat, 21 Apr 2007 11:39:02 -0400
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. :-)
#!/usr/bin/perl -w
use strict;
use Gtk2 -init;
my $window = Gtk2::Window->new;
my $label = Gtk2::Label->new ("W");
my $font_desc = Gtk2::Pango::FontDescription->from_string ("Sans Bold");
$font_desc->set_size (512000);
$label->modify_font ($font_desc);
$window->add ($label);
$window->signal_connect (key_press_event => sub {
my ($widget, $event) = @_;
my $key = uc Gtk2::Gdk->keyval_name ($event->keyval);
$label->set_text ($key) if $key =~ m/^[[:alnum:]]$/;
});
$window->signal_connect (destroy => sub { Gtk2->main_quit });
$window->show_all;
Gtk2->main;
__END__
--
One, two, free, four, five, six, sebben, eight, nine, ten, elebben,
twull, fourteen, sickteen, sebbenteen, eightteen, elebbenteen,
fiffeen, elebbenteen!
-- Zella, aged three, counting to twenty.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]