표 위젯으로 달성 할 수있는 가장 큰 시각적 제어는 아마도 위젯을 표에 포함 시켜서 수행 할 수 있습니다. 이는 테이블에 사용자의 사양에 우선 적용하기 어려운 기본 바인딩이 있기 때문입니다. 하지만 수 있습니다 아래 삽화와 같은 위젯을 삽입하고 완전히 모양을 제어 할 수 있습니다. 원하는대로 특성 및 바인딩을 가지고 놀 수 있습니다. 그러나 이것은 공정한 시작이어야합니다.
package require Tktable
array set TableTitles {
0,1 Col1 0,2 Col2 1,0 Row1 2,0 Row2, 1,1 a 1,2 b 2,1 c 2,2 d
}
table .t -rows 3 -cols 3 -titlerows 1 -titlecols 1 -variable TableTitles
pack .t
proc EnableEntry { entry } {
$entry configure -state normal -cursor ibeam
$entry selection range 0 end
}
foreach row [list 1 2] {
foreach col [list 1 2] {
set cell [set row],[set col]
# Use the array already created for the entry variable
set entry [entry .t.e$row$col -justify center -textvariable TableTitles($cell) \
-highlightthickness 1 -highlightcolor blue -state disabled \
-disabledbackground white -disabledforeground black -cursor arrow]
bind $entry <Double-Button-1> "EnableEntry $entry"
bind $entry <Button-1> "focus $entry"
bind $entry <FocusOut> "$entry configure -state disabled -cursor arrow"
.t window configure $cell -window $entry
}
}
대단히 감사드립니다. – Jimmy