Hallo!Ich hab da mal ne Frage an euch: Ich soll bis morgen ein TK-Beispiel programmieren, welches ein Handy-GUI sein soll. Wenn man möchte, kann man auch noch nach Belieben erweiterte Funktionalität erstellen, ist aber kein Muss. Die Ausgabe soll über STDOUT erfolgen, sprich im DOS-Fenster angezeigt werden. Mein Beispiel sieht folgendermaßen aus:
# PICHLHÖFER Robert
# 0100549
# N066936#!/usr/bin/perl
use strict;
use warnings;
use Tk;
# Hauptfenster
my $nw = MainWindow->new();
# Titel des Hauptfensters
$nw->title ('Man-Machine Interfaces II - UE - BSP 3');
# Menü
my $mbar = $nw -> Menu();
$nw->configure (-menu => $mbar);
my $file = $mbar->cascade (-label => "File", -underline => 0, -tearoff => 0);
$file->command (-label => "Exit", -command => [$nw => 'destroy']);
# Buttons
my $b1 = $nw->Button (-text => '1', -command => sub {print "1";}, -height => 5, -width => 5)->pack (-side => 'top');
my $b2 = $nw->Button (-text => '2', -command => sub {print "2";}, -height => 5, -width => 5)->pack (-side => 'top');
my $b3 = $nw->Button (-text => '3', -command => sub {print "3";}, -height => 5, -width => 5)->pack (-side => 'top');
my $b4 = $nw->Button (-text => '4', -command => sub {print "4";}, -height => 5, -width => 5)->pack (-side => 'left');
my $b5 = $nw->Button (-text => '5', -command => sub {print "5";}, -height => 5, -width => 5)->pack (-side => 'left');
my $b6 = $nw->Button (-text => '6', -command => sub {print "6";}, -height => 5, -width => 5)->pack (-side => 'left');
my $b7 = $nw->Button (-text => '7', -command => sub {print "7";}, -height => 5, -width => 5)->pack (-side => 'bottom');
my $b8 = $nw->Button (-text => '8', -command => sub {print "8";}, -height => 5, -width => 5)->pack (-side => 'bottom');
my $b9 = $nw->Button (-text => '9', -command => sub {print "9";}, -height => 5, -width => 5)->pack (-side => 'bottom');
my $b0 = $nw->Button (-text => '0', -command => sub {print "0";}, -height => 5, -width => 5)->pack (-side => 'bottom');
MainLoop();
Im Fenster sollten die Buttons eigentlich so gereiht und gleich groß sein:
1 2 3
4 5 6
7 8 9
0
Wie könnte ich das machen?
Als erweiterte Funktionalität könnte man noch die Sternchen- & Raute-Taste dazugeben bzw. zu jeder Zahl auch die Buchstaben (z. B.: bei 1 wäre dann a b c). Wie könnte ich das denn realisieren? Falls ich die erweiterte Funktionaltität nicht habe, ist es kein Problem, da man es nach Belieben machen kann und daher kein Muss ist.
Vielen lieben Dank für eure Hilfe.
LG,
Robert!
Datum: 10.06.2007-13:32
