#!/usr/bin/perl $VERSION = 1.00; use strict; use Tk; use Tk::FileSelect; use Tk::MsgBox; my ($value, %deck); #main window my $mw = MainWindow->new(); $mw->geometry("400x200"); #file selector my $file_dialog = $mw->Button( -text => 'Load Cards', -command => \&load_deck ) ->grid(-row=>6,-column=>0); #flip button my $flip = $mw->Button( -text => 'Flip', -command => \&flip_card ) ->grid(-row=>6,-column=>2); #next button my $next = $mw->Button( -text => 'Next =>', -command => \&next_card ) ->grid(-row=>6,-column=>4); #front label & display $mw->Label( -text => 'Front: ' )->grid(-row=>0); my $front = $mw->Label()->grid(-row=>0,-column=>2); #back display my $back = $mw->MsgBox(-title=>'Back of card',-default=>'ok',-message=>$value); $mw->Button( -text => 'Quit', -command => sub { exit } ) ->grid(-row=>7,-column=>2); MainLoop; sub load_deck { my $start_dir = "/home/$ENV{'USER'}/TkPerl"; my $FSref = $mw->FileSelect(-directory => $start_dir); my $file = $FSref->Show; dbmopen(%deck, $file, 0644); next_card(); } sub next_card { my ($key, $loc_val) = each (%deck); $value = $loc_val; $front->configure(-text=>$key); } sub flip_card { my $pop = $back->Show; } #### use strict; use CGI;