So geht es:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl
use strict;
use warnings;
use Tk;
use Tk::Spinbox;
my $mw = tkinit();
my $sb = $mw->Spinbox(
-justify => 'center',
-from => 1,
-to => 99,
-increment => 1,
-format => '%3.0f',
-width => 10,
)->pack;
$mw->MainLoop();
Laut Doku:
QuoteOption: -format
Name: format
Class: Format
Specifies an alternate format to use when setting the string value when using the -from and -to range. This must be a format specifier of the form %<pad>.<pad>f, as it will format a floating-point number.
Es ist immer ein Float, also muss man den immer ohne Komma formatieren :)