我试图用Tcl.tk构建Gui并在ICC(Synopsys)中使用它。 问题:所有文本都有理由居中而不是左。 每一次创造" checkbutton"在中心显示文字。 如何订购文本以证明左侧是正确的? 如何禁用" checkbutton"?
周围的光环 package require Tk 8.4
set default_font *adobe*helvetica*bold-r-normal*12*
option add *font $default_font
option add *background #D4D0C8
option add *foreground #000000
option add *activeBackground #ececec
option add *activeForeground #100
option add *selectBackground #c3c3c3
option add *disableForeground #a3a3a3
option add *troughColor #c3c3c3
option add *highlightBackground #d9d9d9
option add *width 2
proc ttt {} {
set mainWin ".win"
destroy $mainWin
toplevel $mainWin -padx 1 -pady 1
wm title $mainWin "Aviadz Tools"
wm geometry $mainWin +50+50
wm resizable $mainWin 1 1
frame $mainWin.top -borderwidth 1
pack $mainWin.top -side top -fill x -ipadx 200 -ipady 300 -anchor nw
labelframe $mainWin.top.icc -text " ICC " -fg blue -padx 5 -pady 5
pack $mainWin.top.icc -side top -anchor nw
place $mainWin.top.icc -x 1 -y 1 -width 300 -height 160
place [checkbutton $mainWin.top.icc.change_name -background grey -text "Change names" -justify left] -x 1 -y 0
place [checkbutton $mainWin.top.icc.vout -background grey -text "Verilog Out" -justify left] -x 1 -y 30
place [checkbutton $mainWin.top.icc.defout -background grey -text "DEF Out" -justify left] -x 1 -y 60
place [checkbutton $mainWin.top.icc.copy_mw_lib -background grey -text "Copy MW Lib" -justify left] -x 1 -y 90
pack $mainWin.top.icc.change_name $mainWin.top.icc.vout $mainWin.top.icc.defout
$mainWin.top.icc.copy_mw_lib -anchor w
button $mainWin.start -background green -text "Start" -command start
place $mainWin.start -x 158 -y 250
pack $mainWin.start -side bottom -fill x
}
答案 0 :(得分:1)
您可以使用anchor
选项将文本放在窗口小部件中,例如:
button .c -text "Test" -width 100 -anchor w