1
2
3
4
5
6
7
8
9
# Abgespeckte Spinbox zur Anzeige von Floats in .1er Schritten
my $sb = $mw->Spinbox(
-justify => 'center',
-from => 1,
-to => 99,
-increment => .1,
-format => '%.2f',
-width => 4,
)->pack;
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();
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.