Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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.

Comment on Re: Grabbing a variable a a tk listbox.
Download Code

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 studying the Monastery: (3)
As of 2015-11-29 18:51 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (752 votes), past polls