#!/usr/bin/env perl use warnings; use strict; use Tk; my %script_mod_for = ( Freeze => 'Pm_1148798_freeze_tk_mod', Dummy => 'Pm_1148798_dummy_tk_mod', ); my $mw = MainWindow::->new(); $mw->geometry("500x300+50+50"); my $script_F = $mw->Frame->pack(-side => 'bottom', -fill => 'x'); my $button_F = $mw->Frame->pack(-side => 'left', -fill => 'y'); my $text_ST = $mw->Scrolled('Text', -scrollbars => 'se' )->pack(-expand => 1, -fill => 'both'); my @script_buttons; push @script_buttons, $button_F->Button(-text => $_, -command => [ \&show_script_gui, $_, $script_mod_for{$_}, $script_F, $text_ST, \@script_buttons ])->pack(-fill => 'x') for keys %script_mod_for; $button_F->Button(-text => 'Exit', -command => sub { exit } )->pack(-fill => 'x'); MainLoop; sub show_script_gui { my ($script, $mod, $script_F, $text_ST, $script_buttons) = @_; $text_ST->insert(end => "Running script: $script\n"); eval "require $mod"; $_->configure(-state => 'disabled') for @$script_buttons; $mod->run($script_F, $text_ST, $script_buttons); }