in reply to Tk Listbox item padx

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:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Tk Listbox item padx
by kcott (Archbishop) on Apr 09, 2020 at 06:43 UTC

    G'day AnomalousMonk,

    I don't know which widget you were thinking of. You didn't specify anything different from the Tk::Listbox widget that the OP asked about. That widget does not support any of the options you suggested. Here's two of them; the other two failed with similar messages.

    $ 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'

    — Ken

      It was the mention of  padx in the OP title that brought  -ipadx -ipady to mind. These are pack options, but apparently  -ipadx doesn't do quite what I imagined; this

      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:  <%-{-{-{-<

        The -ipad options are only available in a few places. Both the Tk::pack and Tk::grid geometry managers have them; I can't think of any others off the top of my head.

        The -pad options are more common. The geometry managers mentioned above, as well as Tk::form, have them. A number of widgets, such as Tk::Button and Tk::Text, also have them.

        — Ken