longstocks
Programmer
To avoid typing the same many lines 9 times, (and because i didnt figure out why one of the images were missing) i made a sub and used references to blablabla you get the deal when you look at the code
take a look at the code. The problem is the image doesn't show.
When not using refs and a sub the result of everything looked like this:
Btw it's just a christmas gift for my younger sister.
Thanks for the help, it's greatly appreciated!
Code:
#!/usr/bin/perl
use Tk;
use Tk:
hoto;
use Tk::Button;
my $vindu = MainWindow->new(-name => 'vindu', -title=>'Overnoobfriendly ZSNES interface');
sub rendergame {
$spill = shift @_;
$tekst = shift @_;
$file = $spill.".gif";
$l_ref = shift @_;
$fl_ref = shift @_;
$b_ref = shift @_;
$row = shift @_;
$col = shift @_;
$$l_ref = $vindu->Label( );
$$f1_ref = $vindu->Photo( -file => $file);
$$l_ref->configure( -image => $$fl_ref );
$$b_ref = $vindu->Button(-text => "Spill $tekst!", -command => sub {system("ZSNESW.EXE $spill.smc")});
$$l_ref->grid(-row=>$row,-column=>$col);
$$b_ref->grid(-row=>++$row,-column=>++$col,-sticky=>'ew');
}
rendergame("allstars","Super Mario Allstars",\$l_allstars,\$fl_allstars,\$b_allstars,1,1);
Tk::MainLoop;

When not using refs and a sub the result of everything looked like this:
Btw it's just a christmas gift for my younger sister.
Thanks for the help, it's greatly appreciated!
Code:
#!/usr/bin/perl
use Tk;
use Tk:

use Tk::Button;
my $vindu = MainWindow->new(-name => 'vindu', -title=>'Overnoobfriendly ZSNES interface');
sub rendergame {
$spill = shift @_;
$tekst = shift @_;
$file = $spill.".gif";
$l_ref = shift @_;
$fl_ref = shift @_;
$b_ref = shift @_;
$row = shift @_;
$col = shift @_;
$$l_ref = $vindu->Label( );
$$f1_ref = $vindu->Photo( -file => $file);
$$l_ref->configure( -image => $$fl_ref );
$$b_ref = $vindu->Button(-text => "Spill $tekst!", -command => sub {system("ZSNESW.EXE $spill.smc")});
$$l_ref->grid(-row=>$row,-column=>$col);
$$b_ref->grid(-row=>++$row,-column=>++$col,-sticky=>'ew');
}
rendergame("allstars","Super Mario Allstars",\$l_allstars,\$fl_allstars,\$b_allstars,1,1);
Tk::MainLoop;