If you don't want to prepend a space to each element in the list, use a more advanced type of a list. For example, a Tk::HList:
#! /usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::HList;
my $mw = 'MainWindow'->new(-title => 'Listbox test');
my $hl = $mw->HList(-drawbranch => 0,
-pady => 0,
-padx => 10 # <- This is what you need!
)->pack;
for ('A' .. 'H') {
$hl->addchild("", -text => $_);
}
MainLoop();
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |
Thanks, choroba, for pointing me to the HList widget. The behaviour was exactly what I was loking for.
2020-04-10 Athanasius s/Corion/choroba/.
| [reply] |
Not quite sure just what you want, but maybe investigate -ipadx -ipady for internal padding, whereas -padx -pady pad the exterior of a widget.
Give a man a fish: <%-{-{-{-<
| [reply] [d/l] [select] |
$ perl -e 'use Tk; my $mw = tkinit; $mw->Listbox(-ipadx => 1)->pack; M
+ainLoop'
unknown option "-ipadx" at /long/path/to/Tk/Widget.pm line 205.
at -e line 1.
$ perl -e 'use Tk; my $mw = tkinit; $mw->Listbox(-padx => 1)->pack; Ma
+inLoop'
unknown option "-padx" at /long/path/to/Tk/Widget.pm line 205.
at -e line 1.
And purely as a test control, this worked:
$ perl -e 'use Tk; my $mw = tkinit; $mw->Listbox()->pack; MainLoop'
| [reply] [d/l] [select] |
c:\@Work\Perl\monks>perl -wMstrict -le
"use Tk;
;;
my $mw = tkinit;
;;
my $lb = $mw->Listbox->pack(-ipadx => 10);
$lb->insert('end', $_) for 'four score and', 'seven years ago', 'our
+fathers';
;;
MainLoop
"
does not produce the left-hand border/indent I expected. Oh, well...
Give a man a fish: <%-{-{-{-<
| [reply] [d/l] [select] |