#!/usr/bin/perl use strict; use warnings; use Tk; # Hauptfenster my $nw = MainWindow->new(); # Titel $nw->title ('Man-Machine Interfaces II - UE - BSP 1'); # Menü my $mb = $nw->Frame (-relief => 'ridge')->pack (-side => 'top', -fill => 'x'); my $m_file = $mb->Menubutton (-text => "File", -underline => 0)->pack (-side => 'left'); $m_file->command (-label => "Activate", -command => sub {activate()}); $m_file->separator(); $m_file->command (-label => "Quit", -command => [$nw => 'destroy']); # Frames my $f1 = $nw->Frame()->pack (-side => 'top', -expand => 1, -fill => 'both'); my $f2 = $nw->Frame()->pack (-side => 'bottom', -expand => 1, -fill => 'both'); # Radiobuttons my $r1 = $f1->Frame (-borderwidth => 3, -relief => 'groove')->pack (-side => 'left', -expand => 1, -fill => 'both'); my @listenwahl = ('1', '2', '3'); my $liste = 0; for my $a (0..$#listenwahl) { $r1->Radiobutton (-text => $listenwahl[$a], -variable => \$liste, -value => $a)->pack (-anchor => 'e'); } my $r2 = $f1->Frame (-borderwidth => 3, -relief => 'groove')->pack (-side => 'left', -expand => 1, -fill => 'both'); my @textwahl = ('normal', 'rückwärts'); my $text = 0; for my $b (0..$#textwahl) { $r2->Radiobutton (-text => $textwahl[$b], -variable => \$text, -value => $b)->pack (-anchor => 'w'); } # Entries my $entry1 = $nw->Entry (-text => "Das ist ein Satz!")->pack (-side => 'top'); my $entry2 = $nw->Entry (-text => "!ztaS nie tsi saD"); # Listboxen und Scrollbars my $listbox1 = $f2->Listbox()->pack (-side => 'left', -expand => 1, -fill => 'both'); my $scrollbar1 = $f2->Scrollbar(-command, [yview => $listbox1])->pack (-side => 'left', -expand => 1, -fill => 'both'); my $listbox2 = $f2->Listbox()->pack (-side => 'left', -expand => 1, -fill => 'both'); my $scrollbar2 = $f2->Scrollbar(-command, [yview => $listbox2])->pack (-side => 'left', -expand => 1, -fill => 'both'); my $listbox3 = $f2->Listbox()->pack (-side => 'left', -expand => 1, -fill => 'both'); my $scrollbar3 = $f2->Scrollbar(-command, [yview => $listbox3])->pack (-side => 'left', -expand => 1, -fill => 'both'); MainLoop();