Button, Entry, Label
Radiobutton, Checkbutton
Frame, Text, Scrollbar, Scale
Widgets 2 : Frame, Text, Scrollbar, Scale
frame
A frame is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. The only features of a frame are its background color and an optional 3-D border to make the frame appear raised or sunken.
Some Options| -relief STYLE | Specifies the 3-D effect desired for the widget. Acceptable values are raised, sunken, flat, ridge, solid, and groove. The value indicates how the interior of the widget should appear relative to its exterior; for example, raised means the interior of the widget should appear to protrude from the screen, relative to the exterior of the widget. |
Example
proc push_button {} {
.ent insert 0 "Hello "
}
frame .frm -relief groove
label .lab -text "Enter name:"
entry .ent
button .but -text "Push Me" -command "push_button"
pack .lab -in .frm
pack .ent -in .frm
pack .frm
pack .but
text
A text widget displays one or more lines of text and allows that text to be edited. Similar to the entry widget but a larger version of it.
Some Options
| -xscrollcommand COMMAND | This is to enable communication between a text widget and a scrollbar widget. There is a -yscrollcommand similler to this one. |
| -font FONTNAME | Specifies the font to use when drawing text inside the widget. |
| -width NUMBER | Specifies the width of the widget |
| -height NUMBER | Specifies the, you guessed it, height of the widget |
| Syntax | Description | Example |
| path get index1 ?index2 ...? | Return a range of characters from the text. The return value will be all the characters in the text starting with the one whose index is index1 and ending just before the one whose index is index2 (the character at index2 will not be returned). If index2 is omitted then the single character at index1 is returned. Note that the index of text is different from that of the entry widget. The index of text widget is in the form LINE_NO.CHARECTER_NO. This means that 1.0 means the first character in the first line. |
set contents [.txt get 1.0 end] |
| path insert index DATA | Inserts all of the chars arguments just before the character at index. If index refers to the end of the text (the character after the last newline) then the new text is inserted just before the last newline instead. | .txt inset end "Hello World" |
Example
proc push_button {} {
set name [.ent get]
.txt insert end "Hello, $name."
}
frame .frm -relief groove
label .lab -text "Enter name:"
entry .ent
button .but -text "Push Me" -command "push_button"
text .txt -width 20 -height 10
pack .lab -in .frm
pack .ent -in .frm
pack .frm
pack .but
pack .txt
scrollbar
A scrollbar is a widget that displays two arrows, one at each end of the scrollbar, and a slider in the middle portion of the scrollbar. It provides information about what is visible in an associated window that displays an document of some sort (such as a file being edited or a drawing). The position and size of the slider indicate which portion of the document is visible in the associated window. For example, if the slider in a vertical scrollbar covers the top third of the area between the two arrows, it means that the associated window displays the top third of its document. It is made to work with other widgets like text. Some Options| -orient DIRECTION | For widgets that can lay themselves out with either a horizontal or vertical orientation, such as scrollbars, this option specifies which orientation should be used. DIRECTION must be either horizontal or vertical or an abbreviation of one of these. |
| -command COMMAND | This command gets executed when the scrollbar is moved. This option almost always has a value such as .t xview or .t yview, consisting of the name of a widget and either xview (if the scrollbar is for horizontal scrolling) or yview (for vertical scrolling). All scrollable widgets have xview and yview commands that take exactly the additional arguments appended by the scrollbar. |
Example
proc push_button {} {
set name [.ent get]
.txt insert end "Hello, $name."
}
frame .frm -relief groove
label .lab -text "Enter name:"
entry .ent
button .but -text "Push Me" -command "push_button"
frame .textarea
text .txt -width 20 -height 10 \
-yscrollcommand ".srl_y set" -xscrollcommand ".srl_x set"
scrollbar .srl_y -command ".txt yview" -orient v
scrollbar .srl_x -command ".txt xview" -orient h
pack .lab -in .frm
pack .ent -in .frm
pack .frm
pack .but
grid .txt -in .textarea -row 1 -column 1
grid .srl_y -in .textarea -row 1 -column 2 -sticky ns
grid .srl_x -in .textarea -row 2 -column 1 -sticky ew
pack .textarea
Grid
As you can see I have used 'grid' here. Grid is NOT a widget. It is a geometry manager like pack but more advanced. Lets take a closer look at the commands -
grid .txt -in .textarea -row 1 -column 1This line will tell the interpreter to put the widget called '.txt' in the widget called '.textarea'(That is a frame, remember?). It will be put in the first column of the first row. The below digram will help you understand.
| Column 1 | Column 2 | |
| Row 1 | '.txt' widget will be here | '.srl_y' widget's place |
| Row 2 | '.srl_x' widget's position. |
Some Options
| -sticky STYLE | This option may be used to position (or stretch) the widget within its cell. STYLE is a string that contains zero or more of the characters n, s, e or w. Each letter refers to a side (north, south, east, or west) that the slave will "stick" to. If both n and s (or e and w) are specified, the slave will be stretched to fill the entire height (or width) of its cavity. |
| -in MASTER | The widget will be put in the MASTER widget. |
| -ipadx AMOUNT | The AMOUNT specifies how much horizontal internal padding to leave on each side of the slave(s). This is space is added inside the slave(s) border. |
| -ipady AMOUNT | The AMOUNT specifies how much vertical internal padding to leave on each side of the slave(s). Options same as -ipadx |
| -padx AMOUNT | The amount specifies how much horizontal external padding to leave on each side of the slave(s), in screen units. AMOUNT may be a list of two values to specify padding for left and right separately. |
| -pady AMOUNT | The amount specifies how much vertical external padding to leave on the top and bottom of the slave(s), in screen units. Options same as -padx. |
| -row N | Insert the slave so that it occupies the Nth row in the grid. Row numbers start with 0. If this option is not supplied, then the slave is arranged on the same row as the previous slave specified on this call to grid, or the first unoccupied row if this is the first slave. |
| -column N | Insert the slave so that it occupies the N'th column in the grid. Options same as -row |
| -rowspan N | Insert the slave so that it occupies N rows in the grid. The default is one row. |
| -columnspan N | Insert the slave so that it occupies N columns in the grid. |
Using grid requires a bit of experience - but if you know HTML it would help a lot. The rows and columns are just like those in HTML tables - although the codes are very different.
scale
Makes a slider that can be adjusted by the user to input a variable.
Some Options| -from NUMBER | Starting Number |
| -to NUMBER | Ending Number |
| -tickinterval NUMBER | Determines the spacing between numerical tick marks displayed below or to the left of the slider. |
| -varable NAME | Specifies the name of a global variable to link to the scale. Whenever the value of the variable changes, the scale will update to reflect this value. Whenever the scale is manipulated interactively, the variable will be modified to reflect the scale's new value. |
| Syntax | Description | Example |
| path get | Get the current value of the scale | set age [.scl get] |
| path set value | Give the scale a new value. | .scl set 20 |
Example
#This function will be executed when the button is pushed
proc push_button {} {
global age
set name [.ent get]
.txt insert end "Hello, $name.\nYou are $age years old."
}
#Global Variables
set age 10
#GUI building
frame .frm -relief groove
label .lab -text "Enter name:"
entry .ent
button .but -text "Push Me" -command "push_button"
#Age
scale .scl -label "Age :" -orient h -digit 1 -from 10 -to 50 \
-variable age -tickinterval 10
#Text Area
frame .textarea
text .txt -yscrollcommand ".srl_y set" -xscrollcommand ".srl_x set" \
-width 20 -height 10
scrollbar .srl_y -command ".txt yview" -orient v
scrollbar .srl_x -command ".txt xview" -orient h
#Geometry Management
pack .lab -in .frm
pack .ent -in .frm
pack .frm
pack .scl
pack .but
grid .txt -in .textarea -row 1 -column 1
grid .srl_y -in .textarea -row 1 -column 2 -sticky ns
grid .srl_x -in .textarea -row 2 -column 1 -sticky ew
pack .textarea
Now our little example is becoming more and more like a program. We have added the comments to it as it has grown big and is difficult to understand. Now we have added a slider with which age can be inputed. You may have also noticed that an new line 'global age' is added. It is not the aged of the earth or the age of every human being combined. It says that the variable 'age' should be taken from the global scope to the scope of the function.

Comments
Is there a way to change the color of the text without effecting the whole widget.
e.g. This code diaplays 3 lines of text, but each time the -configure is used it recolors every line..
text .myTextBox
pack .myTextBox
.myTextBox insert end "Some Black Text \n"
.myTextBox configure -foreground red
.myTextBox insert end "Some Red Text \n"
.myTextBox configure -foreground blue
.myTextBox insert end "Some blue Text \n"
Is there some way I can color each line seperatley?
e.g.
text .myTextBox
.myTextBox tag config makeRed -foreground red
.myTextBox tag config makeBlue -foreground blue
pack .myTextBox
.myTextBox insert end "Some Red Text \n" makeRed
.myTextBox insert end "Some Blue Text \n" makeBlue
Could anyone clarify to me why we cannot leave "global age" out in the last example? I rewrote the push_button procedure like here:
proc push_button {my_own_age} {
set name [.ent get]
.txt insert end "Hello, $name.\nYou are $my_own_age years old."
}
,And putted the scale definition above the button definition in the main program (section #GUI building). But when chosen age value is not equal 10, when program running, the output is always "You are 10 years old."
The command running when the button is pushed is "push_button $age"
Thanks in advance.
If you use braces - {$age} - it will be evaluated every time the function is called.
I want a textbox in tk with facility for password, i.e. inputs entered by users will be seen as "*"...how can i do that????
entry .ent -show *
I need a small help.
I have written a small Tk script here. I am trying to add a y-scrollbar to this. I have created the scrollbar. Can you tell me how to link this scrollbar with the widget ?
I have attached the program here:
#!/usr/bin/wish
exec cp DWE_Suite/threshold_default.rpt adsDWE/threshold.rpt
global check
wm title . Constraint_Editor
scrollbar .scroll -orient vert
pack .scroll -side right -fill y
frame .top -borderwidth 5
pack .top -side top -fill x
proc CommandEntry { name label width args } {
frame $name
label $name.label -text $label -width $width -anchor w
eval {entry $name.entry -relief sunken} $args
pack $name.label -side left
pack $name.entry -fill x -expand true
return $name.entry
}
proc Display { } {
label .top.bucket_size_heading -text "BUCKET SIZE" -width 50 -anchor w
CommandEntry .top.bucket_size "Bucket Size" 50 -textvar check(bucket_size)
pack .top.bucket_size_heading .top.bucket_size
label .top.power_distribution_quality_heading -text "POWER DISTRIBUTION QUALITY" -width 50 -anchor w
CommandEntry .top.enable_power_distribution_quality_check "Enable Power Distribution Quality Check" 50 -textvar check(enable_power_distribution_quality_check)
CommandEntry .top.bucket_power_density_ratio "Bucket Power Density Ratio" 50 -textvar check(bucket_power_density_ratio)
CommandEntry .top.num_violations_power_density_max "Number Of Violations" 50 -textvar check(num_violations_power_density_max)
pack .top.power_distribution_quality_heading .top.enable_power_distribution_quality_check .top.bucket_power_density_ratio .top.num_violations_power_density_max
label .top.charge_distribution_quality_heading -text "CHARGE DISTRIBUTION QUALITY" -width 50 -anchor w
CommandEntry .top.enable_charge_distribution_quality_check "Enable Charge Distribution Quality Check" 50 -textvar check(enable_charge_distribution_quality_check)
CommandEntry .top.bucket_charge_density_ratio "Bucket Charge Density Ratio" 50 -textvar check(bucket_charge_density_ratio)
CommandEntry .top.num_violations_charge_density_max "Number Of Violations" 50 -textvar check(num_violations_charge_density_max)
}
Display
Thanks, Jai
I don't see why not but it does'nt seem to work.
I can only see a blank window. Any clue?
When running the "Scale" program (copy/paste) my WINDOWS XP comes up with this error:
---------------------------------------
unknown option "-state"
unknown option "-state"
while executing
"$w cget -state"
(procedure "tk::ScaleActivate" line 2)
invoked from within
"tk::ScaleActivate . 53 305"
(command bound to event)
---------------------------------------
---------------------------------
unknown option "-state"
unknown option "-state"
while executing
". cget -state"
invoked from within
"if {[. cget -state] eq "active"} {
. configure -state normal
}"
(command bound to event)
----------------------------------
frame must be ALLWAYS declared BEFORE widgets inside her!!! (otherwise they will not be displayed)
done like this:
label .lab -text "Enter name:"
entry .ent
frame .frm -relief groove
instead
frame .frm -relief groove
label .lab -text "Enter name:"
entry .ent
and it didn't work! (neither .ent nor .lab were printed out)
I wrote this simple program and I noticed that the 10 phrases "Hello World" are all printed out at the same time when i=11 at the end of the for loop and not for each cycle of the for loop.
Is there anyone can explain me this behaviour.
Is it possible to execute the command:
.txt insert end "$i $testo\n"
for each cycle of the for loop?
Thank You in advance
Andrea
#-----------------------------
# This program print 10 times "Hello World" in a text widget
set testo "Hello World"
frame .frm -relief solid
text .txt -width 20 -height 20
pack .txt
for {set i 1} {$i<11} {incr i} {
.txt insert end "$i $testo\n"
for {set j 0} {$j<1000000} {incr j} {
}
}
#-------------------------------------
I have problem with scroll in my program. In the first part of program I have to write "Numbers of points" and after push OK button in my program are showing more options. In the window is scroll doesn't work but I need it because when I have more then 10 new rows in my widget I can see next.
Could you can help me
Marcin
---------------------------
This is code of my program
---------------------------
package require sqlite3
toplevel .pol
wm title .pol "Ciąg Poligonowy"
wm geometry .pol 450x250
wm minsize .pol 450 250
wm maxsize .pol 450 250
frame .pol.menubar -relief raised -bd 1
pack .pol.menubar -fill x
menubutton .pol.menubar.plik -text Plik -underline 0 -menu .pol.menubar.plik.menu
menubutton .pol.menubar.edycja -text Edycja -underline 0 -menu .pol.menubar.plik.edycja
menubutton .pol.menubar.licz -text Licz -underline 0 -menu .pol.menubar.plik.licz
menubutton .pol.menubar.wyczysc -text Wyczyść -underline 0 -menu .pol.menubar.plik.wyczysc
pack .pol.menubar.plik .menubar.edycja .menubar.licz .pol.menubar.wyczysc -side left
menubutton .pol.menubar.pomoc -text Pomoc -underline 0 -menu .pol.menubar.plik.pomoc
pack .pol.menubar.pomoc -side right
menu .pol.menubar.plik.menu
.pol.menubar.plik.menu add command -label Zapisz -command "SaveFile"
.pol.menubar.plik.menu add command -label "Zapisz Jako..." -command "SaveAsFile"
.pol.menubar.plik.menu add command -label Drukuj -command "Print"
.pol.menubar.plik.menu add command -label Zamknij -command " destroy .pol "
labelframe .pol.info
pack [frame .pol.info.menu] -pady 3
grid [labelframe .pol.info.menu.miara -text "Miara kątowa"] -row 1 -column 2
radiobutton .pol.info.menu.miara.stopnie -text "Stopnie" -value stopnie -variable miara
radiobutton .pol.info.menu.miara.grady -text "Grady" -value grady -variable miara
pack .pol.info.menu.miara.stopnie .pol.info.menu.miara.grady -side left -padx 2
set miara grady
grid [labelframe .pol.info.menu.katy -text "Kąty"] -row 1 -column 3
radiobutton .pol.info.menu.katy.lewe -text "Lewe" -value lewe -variable katy
radiobutton .pol.info.menu.katy.prawe -text "Prawe" -value prawe -variable katy
pack .pol.info.menu.katy.lewe .pol.info.menu.katy.prawe -side left -padx 2
set katy lewe
set ciagi {
Otwarty Zamknięty
}
grid [labelframe .pol.info.menu.ciag -text "Typ ciągu"] -row 1 -column 4 -sticky ns
ttk::combobox .pol.info.menu.ciag.rodzc -textvariable roc -state readonly -values $ciagi
pack .pol.info.menu.ciag.rodzc
pack [frame .pol.info.ile] -pady 3
grid [label .pol.info.ile.ilp -text "Numbers of points: "] -row 1 -column 1 -pady 3
grid [entry .pol.info.ile.npkt -justify right -width 3 -textvariable npkt -validate key -vcmd {expr {[string is integer %P] && ![string match "0*" %P] && [string len %P] <=2}}] -row 1 -column 2 -pady 3
grid [button .pol.info.ile.gen -text "OK" -width 5 -command { makePOL }] -row 1 -column 3 -padx 5 -pady 3
pack .pol.info -pady 4 -fill x
pack [frame .pol.pn] -pady 5
grid [label .pol.pn.tp1 -text "Nawiązanie początkowe: "] -row 2 -column 1
grid [label .pol.pn.tnrn1 -text "Nr Pkt" -width 7 -relief raised] -column 2 -row 1 -padx 1 -pady 1
grid [label .pol.pn.nrn1 -text "" -width 7 -relief sunken] -row 2 -column 2
grid [label .pol.pn.txn1 -text "X" -width 11 -relief raised] -row 1 -column 3 -padx 1 -pady 1
grid [label .pol.pn.xn1 -text "" -width 11 -relief sunken] -row 2 -column 3
grid [label .pol.pn.tyn1 -text "Y" -width 11 -relief raised] -row 1 -column 4 -padx 1 -pady 1
grid [label .pol.pn.yn1 -width 11 -relief sunken] -row 2 -column 4
grid [label .pol.pn.o -text ""] -row 3 -column 1
grid [label .pol.pn.tp2 -text "Nawiązanie końcowe: "] -row 5 -column 1
grid [label .pol.pn.tnrn2 -text "Nr Pkt" -width 7 -relief raised] -column 2 -row 4 -padx 1 -pady 1
grid [label .pol.pn.nrn2 -text "" -width 7 -relief sunken] -row 5 -column 2
grid [label .pol.pn.txn2 -text "X" -width 11 -relief raised] -row 4 -column 3 -padx 1 -pady 1
grid [label .pol.pn.xn2 -text "" -width 11 -relief sunken] -row 5 -column 3
grid [label .pol.pn.tyn2 -text "Y" -width 11 -relief raised] -row 4 -column 4 -padx 1 -pady 1
grid [label .pol.pn.yn2 -text "" -width 11 -relief sunken] -row 5 -column 4
proc makePOL { } {
wm geometry .pol 470x400
wm minsize .pol 470 350
wm maxsize .pol 470 450
destroy .pol.pn .pol.t .pol.s
canvas .pol.t -height 150 -highlightthickness 0 -yscrollcommand {.pol.s set}
pack [label .pol.t.h]
pack [ttk::checkbutton .pol.t.h.wys -text "Set high" -onvalue wyzh -offvalue nwyzh -variable wys -command { wyznwys }]
pack [frame .pol.t.pn1] -pady 5
grid [label .pol.t.pn1.tp1 -text "Nawiązanie początkowe: "] -row 2 -column 1 -padx 2 -pady 1
grid [label .pol.t.pn1.tnrn1 -text "Nr Pkt" -width 7 -relief raised] -column 2 -row 1 -padx 1 -pady 1
grid [entry .pol.t.pn1.nrn1 -width 7 -justify right -textvariable nrx1 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=7}}] -row 2 -column 2
grid [label .pol.t.pn1.txn1 -text "X" -width 11 -relief raised] -row 1 -column 3 -padx 1 -pady 1
grid [entry .pol.t.pn1.xn1 -width 11 -justify right -textvariable xn1 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=11}}] -row 2 -column 3
grid [label .pol.t.pn1.tyn1 -text "Y" -width 11 -relief raised] -row 1 -column 4 -padx 1 -pady 1
grid [entry .pol.t.pn1.yn1 -width 11 -justify right -textvariable yn1 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=11}}] -row 2 -column 4
pack [labelframe .pol.t.tab]
grid [label .pol.t.tab.nr -text "Nr Pkt" -width 7 -relief raised] -column 1 -row 1
grid [label .pol.t.tab.kath -text "Kąt poz." -width 8 -relief raised] -column 2 -row 1
grid [label .pol.t.tab.bok -text "Bok" -width 8 -relief raised] -column 4 -row 1
grid [label .pol.t.tab.x -text "X" -width 11 -relief raised] -column 5 -row 1
grid [label .pol.t.tab.y -text "Y" -width 11 -relief raised] -column 6 -row 1
grid [label .pol.t.tab.n] -row 2 -column 1
grid [label .pol.t.tab.kh] -row 2 -column 2
grid [label .pol.t.tab.b] -row 2 -column 4
grid [label .pol.t.tab.px] -row 2 -column 5
grid [label .pol.t.tab.py] -row 2 -column 6
for {set i 1} {$i <= ($::npkt+2)} {incr i} {
pack [entry .pol.t.tab.n.nr$i -width 7 -justify right -textvariable nr$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=7}}]
grid [entry .pol.t.tab.kh.kh1$i -width 3 -justify right -textvariable kh1$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=3}}] -row $i -column 1
grid [entry .pol.t.tab.kh.kh2$i -width 2 -justify right -textvariable kh2$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=2}}] -row $i -column 2
grid [entry .pol.t.tab.kh.kh3$i -width 2 -justify right -textvariable kh3$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=2}}] -row $i -column 3
}
for {set i 1} {$i < ($::npkt+2)} {incr i} {
pack [entry .pol.t.tab.b.bok$i -width 8 -justify right -textvariable odl$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <9}}]
}
for {set i 1} {$i <= ($::npkt+2)} {incr i} {
pack [entry .pol.t.tab.px.xp$i -width 11 -justify right -textvariable xp$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <11}}]
pack [entry .pol.t.tab.py.yp$i -width 11 -justify right -textvariable yp$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <11}}]
}
pack [frame .pol.t.pn2] -pady 5
grid [label .pol.t.pn2.tp2 -text "Nawiązanie końcowe: "] -row 2 -column 1
grid [label .pol.t.pn2.tnrn2 -text "Nr Pkt" -width 7 -relief raised] -column 2 -row 1 -padx 2 -pady 1
grid [entry .pol.t.pn2.nrn2 -width 7 -justify right -textvariable nrx2 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=7}}] -row 2 -column 2
grid [label .pol.t.pn2.txn2 -text "X" -justify right -width 11 -relief raised] -row 1 -column 3 -padx 1 -pady 1
grid [entry .pol.t.pn2.xn2 -width 11 -justify right -textvariable xn2 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=11}}] -row 2 -column 3
grid [label .pol.t.pn2.tyn2 -text "Y" -justify right -width 11 -relief raised] -row 1 -column 4 -padx 1 -pady 1
grid [entry .pol.t.pn2.yn2 -width 11 -justify right -textvariable yn2 -validate key -vcmd {expr {[string is int %P] && ![string match "0*" %P] && [string len %P] <=11}}] -row 2 -column 4
scrollbar .pol.s -orient vertical -command {.pol.t yview}
pack .pol.t -side left -fill both -expand 1
pack .pol.s -side right -fill y
}
proc wyznwys {} {
if { $::wys == "wyzh" } {
grid [label .pol.t.tab.katv -text "Kąt pion." -width 8 -relief raised] -column 3 -row 1
grid [label .pol.t.tab.kv] -row 2 -column 3
for {set i 1} {$i < ($::npkt+2)} {incr i} {
grid [entry .pol.t.tab.kv.kv1$i -width 3 -justify right -textvariable kv1$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=3}}] -row $i -column 1
grid [entry .pol.t.tab.kv.kv2$i -width 2 -justify right -textvariable kv2$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=2}}] -row $i -column 2
grid [entry .pol.t.tab.kv.kv3$i -width 2 -justify right -textvariable kv3$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <=2}}] -row $i -column 3
}
grid [label .pol.t.tab.z -text "Z" -width 11 -relief raised] -column 7 -row 1
grid [label .pol.t.tab.pz] -row 2 -column 7
for {set i 1} {$i <= ($::npkt+2)} {incr i} {
pack [entry .pol.t.tab.pz.zp$i -width 11 -textvariable zp$i -validate key -vcmd {expr {[string is double %P] && ![string match "0*" %P] && [string len %P] <9}}]
}
} else {
destroy .pol.t.tab.katv .pol.t.tab.kv .pol.t.tab.z .pol.t.tab.pz
}
}
a, strong, em, b, i, code, pre, pandbrallowed. Other tags will be shown as code(< will become <). Urls, Line breaks will be auto-formated.