Thread Tk: Spinbox Anzeigeformat (3 answers)
Opened by Molaf at 2011-06-29 16:08

pktm
 2011-06-29 16:42
#150038 #150038
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
So geht es:
Code: (dl )
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:
Quote
Option: -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 :)
http://www.intergastro-service.de (mein erstes CMS :) )

View full thread Tk: Spinbox Anzeigeformat