You could try something like this: A Scrolled Pane filled with checkboxes. You may need to test the height of your font, to get the right height for the Pane, I just hardcoded in 45. Also remember, you need a minimum Pane height to show the scrollbar arrows, unless you make your own custom ones.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
require Tk::Pane;
my $mw = MainWindow->new;
my $text = $mw->Scrolled("Text",
-relief => 'sunken',
-borderwidth => 2,
-setgrid => 1,
-height => 10,
-width => 20,
-scrollbars => 'oe')->pack();
$mw->Label(-text=>'Select from choices below')->pack();
my $pane = $mw->Scrolled('Pane',
-height => 45,
-bg => 'lightgreen',
-scrollbars=>'osoe',
)->pack(-fill => 'x',-expand=>'yes');
for my $choice(1..30){
my $b1 = $pane->Checkbutton(
-text => $choice,
-relief => 'flat',
-command=> sub{
$text->insert('end',"$choice\n");
},
)->pack(-side => 'top', -pady => 1 ,-anchor => 'w');
}
$pane->focus;
MainLoop;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.