mikasue has asked for the wisdom of the Perl Monks concerning the following question:

I have searched CPAN.org and my TK books. I can't find a drop down widget. I see a list box but no drop down. Am I overlooking it?

Replies are listed 'Best First'.
Re: Where is the DropDown Box in Perl/Tk?
by liverpole (Monsignor) on May 22, 2006 at 18:33 UTC
    Hi mikasue,

    Is it perhaps the Optionmenu you want?

    For example:

    #!/usr/bin/perl -w + use strict; use warnings; + use Tk; + my @days = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday ); my $day = "Sunday"; + my $mw = MainWindow->new; my $fr = $mw->Frame()->pack(); my $om = $fr->Optionmenu(-variable => \$day, -options => \@days, -command => sub { use_day() } )->pack(); MainLoop; + + sub use_day { print "The day you chose is ... $day\n"; }

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Re: Where is the DropDown Box in Perl/Tk?
by runrig (Abbot) on May 22, 2006 at 18:38 UTC
    In addition to Optionmenu, BrowseEntry says it's a poor man's Combo box (I haven't used either one, so YMMV).

    Update: A list of alternatives is in the JComboBox docs.

Re: Where is the DropDown Box in Perl/Tk?
by strat (Canon) on May 23, 2006 at 07:42 UTC
    or Tk::JComboBox

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: Where is the DropDown Box in Perl/Tk?
by vkon (Curate) on May 23, 2006 at 16:32 UTC
    Many alternatives of dropdown box of Tcl/Tk are more attractive than perl/Tk (e.g. BrowseEntry et al were frustrating to me)

    So, you use Tcl/Tk's widgets via Tcl::Tk CPAN module and even native-looking (using Tile) and here you go!