Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-11-23 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls