#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::JPEG; my $width = 300; my $height = 300; my $mw = MainWindow->new( -background => 'lightgreen' ); $mw->geometry( $width . 'x' . $height . '+40+40' ); #get answers my $count = 0; my %ans; while(){ my (@linedata) = split /\|/, $_; $ans{$count} = join "\n", @linedata; $count++; } $mw->fontCreate('medium', -family=>'courier', -weight=>'bold', -size=>int(-14*14/10)); my $eightim = $mw->Photo(-data => get_img() ); my $canv = $mw->Canvas( -width => $width, -height => $height, -background => 'lightgreen', )->pack(-expand=>1, -fill=>'both'); my $ball = $canv->createOval( 0, 0, $width, $height, -fill => 'black', -tags => ['ball'], ); my $hole = $canv->createOval( $width * .25,( $height * .25 ) - 30, $width * .75,( $height * .75 ) - 30, -fill => '#7f7f7f', -tags => ['hole'], ); my $eight = $canv->createImage( ($width * .5), ($height * .5) - 20, -image => $eightim, -anchor => 's', -tags => ['8im'], ); my $text = $canv->createText( $width * .5, $height * .5 , -text => '', -font => 'medium', -fill => 'white', -anchor => 's', -tags => ['text'], ); my $qtext = $canv->createText( $width/2, $height - 40 , -text => 'Click to ask', -font => 'medium', -fill => 'yellow', -anchor => 's', ); $mw->bind ('