use strict; use Tcl::Tk; my $mw = Tcl::Tk::tkinit; $mw->title("test"); $mw->interp->Eval(<<'EOS'); #. configure -height 550 #. configure -width 280 package require tkdnd catch {console show} pack [ttk::button .drop_target -text " Drop Target (I can accept anything!) "] \ -fill x -padx 20 -pady 20 pack [ttk::button .drop_target2 -text " Drop Target (I can accept anything!) "] \ -fill x -padx 20 -pady 20 tkdnd::drop_target register .drop_target DND_Files bind .drop_target <> {puts "Generic data drop: \"%D\"!!"; return %A} bind .drop_target <> {puts "Dropped text: \"%D\""; return %A} bind .drop_target <> {puts "Dropped files: \"[join %D {, }]\""; return %A} bind .drop_target <> {file copy %D "cities.txt"} #split string %D,"," EOS #old GUI code - block #1 #my $int = new Tcl::Tk; #my $mw = $int->mainwindow; #$mw->title("test"); #my $frame_border_top = $mw->Frame( -relief => "flat" ); #testing code - block #1 #my $interp = $mw->interp; #my $lab_stat = $mw->Label(qw/-relief sunken -bd 1 -width 60 -text test -anchor w/)->pack(qw/-side bottom -fill x/); #$mw->Frame(-height=>10)->pack(qw/-side bottom -fill x/); #more older GUI code #my $frame_border_top = $mw->Frame( -relief => "flat" ); # $frame_border_top->Label( -text => "test" ); #$frame_border_top->grid( -row => 1, -column => 1, -columnspan => 1 ); #$welcome_label->grid( -row => 1, -column => 1, -columnspan => 2); #listbox #################################### #user selects match type my @fuzzys = qw/ exact fuzzy/; my $lb3 = $mw->Listbox(-selectmode => 'single', ); $lb3->pack(-side => 'left', -fill => 'both'); $lb3->insert('end', sort @fuzzys); $lb3->bind('', { $lb3->curselection }); { $lb3->configure(-exportselection => 0)}; $lb3->grid( -row => 6, -column => 3, -columnspan => 1); #################################### #left over from example - save to study # Tcl inclusion for GUI finished here; you can work with widgets here like: # my $lab = $mw->interp->widget('.status'); # $lab->configure(-text=>'new text here...'); Tcl::Tk::MainLoop;