Thread Automatischer Programmstart nach Programmeende (9 answers)
Opened by der_thomas at 2016-07-01 09:57

hlubenow
 2016-07-01 22:25
#184989 #184989
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
2016-07-01T18:31:13 der_thomas
Genau, das ist mein Plan bzw. meinte meinte ich mit einer 'Log Datei'.

Ach so. Na, zum Beenden eines Tk-Programms wird wohl irgendwo
Code (perl): (dl )
$mw->destroy();

stehen. Davor kannst Du noch Dinge ausführen, z.B. in eine Datei schreiben. Beispiel:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use warnings;
use strict;

use Tk;

my $mw = MainWindow->new();
my $exit_btn = $mw->Button(-text => "Exit",
                           -command => \&end_program);
$exit_btn->pack();
$mw->MainLoop();

sub end_program {
    # open(my $fh, ">", "logfile");
    # print $fh "Application finished.\n";
    # close($fh);
    print "Application finished.\n";
    $mw->destroy();
}

View full thread Automatischer Programmstart nach Programmeende