Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use Tkx; use Tkx::Scrolled; use strict; my $lbox; my $mw= Tkx::widget->new("."); $mw->g_wm_minsize(200,200); $mw->g_wm_resizable(1,1); $mw->g_wm_focus(); display_main(); Tkx::MainLoop; sub clic { #$box_value=$sous_lbox2->get($sous_lbox2->curselection()); my $val=$lbox->curselection(); print "val=$val\n"; return if ($val eq ""); my $value=$lbox->get($lbox->curselection()); print "$value\n"; } sub display_main { # $lbox=$mw->new_tk__listbox(-height=>5,-selectmode => "single"); $lbox=$mw->new_tkx_Scrolled("listbox",-scrollbars=>"se",-height=>5,- +selectmode => "single"); $lbox->g_pack( -anchor=>'n', -padx=>3, -pady=>3, -expand=>1, -fill=>'both'); foreach my $key ("aa","bb","cc") { $lbox->insert('end', "$key- "); } $lbox->g_bind('<ButtonRelease-1>' , sub { clic() }); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: binding listbox with perl tkx
by Marshall (Canon) on Jan 17, 2017 at 19:34 UTC | |
|
Re: binding listbox with perl tkx
by beech (Parson) on Jan 18, 2017 at 00:02 UTC | |
by Anonymous Monk on Jan 18, 2017 at 09:24 UTC | |
|
Re: binding listbox with perl tkx
by Anonymous Monk on Jan 17, 2017 at 21:39 UTC |