We help IT Professionals succeed at work.

Perl tK Listbox question/help?

KGNickl
KGNickl asked
on
Medium Priority
462 Views
Last Modified: 2012-05-11
I have the very basic perl script that has a tk list box that is populated by an array. The screen also has a button that calls a function. When the button is pressed I need the items or items that are selected in the list box to be populated into another array. I'm terrible with tK and can't figure out how to do it. Does anyone know how to do this? Hoping its pretty simple. Thanks!

use Tk;

$mw = MainWindow->new;
$mw->title("Listbox");
@choices = qw/dog cat fish bird/;
my $lb = $mw->Scrolled("Listbox", 
	-scrollbars => "osoe", 
	-selectmode => "multiple"
	)->pack(-side => "left");
$lb->insert("end", sort @choices);
$mw->Button(-text => "Selection To Array", -command => sub { &FillArray })->pack;
MainLoop;

sub FillArray {

    my @ArrayItems;
    print "Code goes here.";

}

Open in new window

Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Submitted before I went to sleep. When I woke up and no one had answered I just did some digging and figured out my own answer/solution to my question.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.