Leser: 19
$mw2->destroy;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use Tk;
use Tk::LabEntry;
use Cwd;
use temp_mat13;
use Materialimport;
$mw = MainWindow->new(-title=>"NG v1.1");
$mw->geometry( "1000x600" );
$BT1 = $F1->Button(-text=>"Template laden mit Dialog", -command=>\&button1)->pack(-side=>left, -padx=>20, -pady=>5);
MainLoop;
sub button1{
$var0 = $LE1->get;
$var1 = 0;
$LE2->configure(-textvariable=>temp_mat13::skript1($var0,$var1));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package temp_mat13;
sub skript1{
my $mw1 = MainWindow->new(-title=>"temp_mat13");
$type = [ ['Template Files', '.template'] ];
if ($_[1]==0){
$name = $mw1->getOpenFile(-initialdir=>$_[0], -title=>"*.template laden", -defaultextension=>".template",-filetypes=>$type);
}elsif($_[1]==1){
$name = $_[0];
}
.
. diverse Befehle, aber keiner davon greift auf Tk zu
.
$mw1->destroy;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
# bitte immer strict und warnings benutzen.
use strict;
use warnings;
use Tk;
use Tk::LabEntry;
use Cwd;
use temp_mat13;
use Materialimport;
my $mw = MainWindow->new(-title=>"NG v1.1");
$mw->geometry( "1000x600" );
my $BT1 = $mw->Button(-text=>"Template laden mit Dialog", -command=>\&button1)->pack(-side=>left, -padx=>20, -pady=>5);
my $LE2=$mw->...
MainLoop;
sub button1{
$LE2->configure(-textvariable=>temp_mat13::skript1($mw, '/', 0));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package temp_mat13;
use strict;
use warnings;
use Tk;
sub skript1{
my $mw = shift(@_);
my $type = [ ['Template Files', '.template'] ];
my $name;
if ($_[1]==0){
$name = $mw->getOpenFile(-initialdir=>$_[0], -title=>"*.template laden", -defaultextension=>".template",-filetypes=>$type);
}elsif($_[1]==1){
$name = $_[0];
}
#.
#. diverse Befehle, aber keiner davon greift auf Tk zu
#.
}