use warnings;
use strict;
use Tk;
use Tk::Dialog;

# Das mw erzeugen
my $mw = MainWindow->new(-background => 'lightskyblue1');
$mw->Label(-text => '     Test für Dialog     ')->pack();

my ($dialog, $bye, $label, $status);

# Status vorbelegen
$status = 'Antwort';
$label = $mw->Label(-relief => 'ridge',
                    -width => 10,
                    -textvariable => \$status);
$label->pack(-padx => 10, -pady => 10);

$dialog = $mw->Dialog(-title          => 'Test',
                      -text           => 'Sind Sie sicher',
                      -bitmap         => '@./smile.xbm',
                      -default_button => 'ja',
                      -buttons        => ['ja', 'nein', 'weiss nicht']);

$bye    = $mw->Dialog(-title          => 'Beenden',
                      -text           => 'Wirklich beenden?',
                      -bitmap         => 'warning',
                      -default_button => 'yes',
                      -buttons        => ['yes', 'no', 'ignore']);

# sinnlose Programmschleife

while ($status ne 'ja')
  {
  # Fenster 1 aufpoppen
  $status = $dialog->Show();
  sleep 1;
  # Falls 'ja# geklickt wurde, Fenster 3 aufpoppen
  if ($status eq 'ja')
    {
    $status = $bye->Show();
    exit if($status eq 'yes');
    }
  }

MainLoop;