#!/usr/bin/perl use strict; use warnings; use Tk; use Cwd; my @entries = getEntriesFromGUI(); foreach my $i (@entries) { print "$i\n"; } sub getEntriesFromGUI { my @res = (); my $mw = Tk::MainWindow->new(); $mw -> title("Latex-Macro-Changer"); if ($^O eq "linux") { $mw -> optionAdd("*font", "Arial 16"); } else { $mw -> optionAdd("*font", "Arial 10"); } $mw -> geometry("+320+200"); my $fr1 = $mw -> Frame(); my $lab1 = $fr1 -> Label(-text => "Ordner"); my $e1 = $fr1 -> Entry(-bg => 'white', -fg => 'black'); $e1 -> insert(0, Cwd::getcwd()); $e1 -> focus(); $lab1 -> pack(-side => 'left', -padx => 10); $e1 -> pack(-padx => 10); $fr1 -> pack(-pady => 10); my $fr2 = $mw -> Frame(); my $lab2 = $fr2 -> Label(-text => "Datei"); my $e2 = $fr2 -> Entry(-bg => 'white', -fg => 'black'); $e2 -> insert(0, "Dateiname"); $lab2 -> pack(-side => 'left', -padx => 10); $e2 -> pack(-padx => 10); $fr2 -> pack(-pady => 10); my $fr3 = $mw -> Frame(); my $lab3 = $fr3 -> Label(-text => "Autor"); my $e3 = $fr3 -> Entry(-bg => 'white', -fg => 'black'); $e3 -> insert(0, "Name des Autors"); $lab3 -> pack(-side => 'left', -padx => 10); $e3 -> pack(-padx => 10); $fr3 -> pack(-pady => 10); my $btn = $mw -> Button(-text => "OK", -command => sub { @res = ($e1 -> get(), $e2 -> get(), $e3 -> get()); $mw -> destroy(); }); $btn -> pack(-anchor => 'se', -padx => 10, -pady => 10); $mw -> bind('', sub { $btn -> invoke} ); Tk::MainLoop(); return @res; }