Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Grabbing a variable a a tk listbox.

by Caillte (Friar)
on Apr 16, 2002 at 11:32 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found