Leser: 1
![]() |
![]() |
10 Einträge, 1 Seite |
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 -w
use Tk;
use Tk::DirTree;
use Cwd;
use strict;
my $Ladepfad;
my $Datenspeichern = MainWindow->new;
$Datenspeichern->title("Datei laden");
$Ladepfad= Cwd::cwd();
$Datenspeichern->Scrolled('DirTree',
-scrollbars => 'osoe',
-width => 30,
-height => 10,
-selectmode => 'browse',
-exportselection => 1,
-browsecmd => sub { $Ladepfad = shift },
# With this version of -command a double-click will
# select the directory
-command => sub { $ok = 1 },
# With this version of -command a double-click will
# open a directory. Selection is only possible with
# the Ok button.
#-command => sub { $d->opencmd($_[0]) },
)->pack(-fill => "both", -expand => 1);
# Set the initial directory
$d->chdir($Ladepfad);
MainLoop;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $path;
my $mw = tkinit();
$mw->Entry(-textvariable => \$path)->pack();
$mw->Button(-command => \&search_file, -text => 'Datei wählen')->pack();
MainLoop;
sub search_file{
$path = $mw->getOpenFile();
}
perl -MTk -e 'warn tkinit->getOpenFile'
1
2
3
4
5
6
7
8
9
10
my @types =
(["Alle Bilddateien", ['IMAGES', '.jpg|.gif|.bmp|.jpeg|.png']]);
$photo_frame->Button(-text => '-',
-command => sub {
$photo_file = $top->getOpenFile(
-filetypes => @types);
$top->update();
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $path;
my $mw = tkinit();
$mw->Entry(-textvariable => \$path)->pack();
$mw->Button(-command => \&search_file, -text => 'Datei wählen')->pack();
MainLoop;
sub search_file{
my @filetypes = (['All Images', ['.GIF','.XBM','.XPM','.BMP']],
['All Images',['.PNG','.PPM','.PGM','.JPEG','.JPG']],);
$path = $mw->getOpenFile(-filetypes => \@filetypes);
}
![]() |
![]() |
10 Einträge, 1 Seite |