Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Grabbing a variable a a tk listbox.

by Caillte (Friar)
on Apr 16, 2002 at 11:32 UTC ( #159454=note: print w/ replies, xml ) Need Help??

in reply to Grabbing a variable a a tk listbox.

This simple script may help

#!/usr/bin/perl -w use Tk ; use strict; my $top = MainWindow->new; my @words = qw(foo fum far bim baz); my $list = $top->ScrlListbox(-scrollbars => 'e', -width => 70) ; $list->pack ; my $label = $top->Label(-text => ''); $label->pack(-fill => 'both', -expand => 1); $list->bind('<1>' => [sub {&showword($list, $label)} ] ) ; grep ($list->insert('end',$_), @words) ; MainLoop ; sub showword{ my $w = shift ; my $lab = shift; my $word ; $word = $w->get($w->curselection) ; $lab->configure(-text => $word ) ; }

This page is intentionally left justified.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://159454]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2016-07-25 17:37 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (225 votes). Check out past polls.