Thread Warten auf Toplevel-Fenster unterhalb einer Subroutine mit MainLoop funktioniert nicht (2 answers)
Opened by skontox at 2008-08-31 16:49

skontox
 2008-09-01 15:17
#114164 #114164
User since
2003-08-06
193 Artikel
BenutzerIn
[default_avatar]
Besten Dank "# Kein Kommentar"!

genau sowas habe ich gesucht.
Hier nochmal Dein Beispiel angepasst an meinen direkten Wunsch ;-):
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/perl
use warnings;
use strict;

use Tk;
my $mw=MainWindow->new(-title=>"Hauptfenster");

createWindowandWait();

print "fertig!\n";

Tk::MainLoop();

sub createWindowandWait{
my $window = $mw->Toplevel();

$window->Button(
-text => 'neues Toplevel-Fenster',
-command => sub{
my $ok = undef;
my $window2 = $mw->Toplevel();
$window2->Button(
-text => 'ok!',
-command => sub{ $ok = 1;}
)->pack();
$window2->focusForce();

# warte solange bis variable '$ok' den wert true hat:
$window2->waitVariable(\$ok);
print "funktioniert ;-), besten Dank!";
$window2->destroy();
}
)->pack();
}

View full thread Warten auf Toplevel-Fenster unterhalb einer Subroutine mit MainLoop funktioniert nicht