我想要一个从左到右填满整个屏幕的框架(因为边框浮雕),并且其中的小部件粘在左侧。但是当我放在-sticky nswe
框架和小部件本身上时,框架占据了整个窗口,但小部件与框架中心-sticky nsw
的左侧对齐,而不是在它的最左侧:
我希望它看起来像(用油漆创建):
创建它的代码是(对于上框架,带有文件扩展名):
编辑:添加了更多代码,并修复了列和行的编号问题
proc eyes_view_create_file_extention_bar {frm_main listOfPossibleExtensions} {
#Files Extention Bar
set files_cb ::eyes_view_file_ext_arr_cb
grid [set file_frm [frame $frm_main.file_frm -relief groove -bd 2]] -row 0 -column 0 -columnspan 2 -sticky nswe
set file_lbl [label $file_frm.lbl -text "File Extenctions to Show:"]
set columns 0
foreach file_ext $listOfPossibleExtensions {
set cb [checkbutton $file_frm.[regsub -all {\.} $file_ext {}] -text $file_ext -variable ${files_cb}(${file_ext}) -command [list _eyes_view_update]]
set ${files_cb}(${file_ext}) 0
grid $cb -row 1 -column $columns -sticky wsn
incr columns
}
grid $file_lbl -row 0 -columnspan $columns -sticky wsn
}
proc eyes_view_main_widget {base listOfExternalVarsAndValues listOfPossibleExtensions} {
wm title $base "Eyes Viewer"
array set [set files_cb ::eyes_view_file_ext_arr_cb] {}
array set [set vars_cb ::eyes_view_vars_arr_cb] {}
set frm_main [frame $base.main_frm]
pack $frm_main -expand 1 -fill both
#graph
set g_frm [frame $frm_main.graph]
grid $g_frm -row 2 -column 1 -sticky nsew
set g [eyes_graph_widget $frm_main.graph graph]
#splits table
grid [set split_frm [frame $frm_main.tbl_split]] -row 2 -column 0 -sticky nswe
set apply_button [button $split_frm.apply -text "Apply" -command [list _eyes_view_update]]
set split_tbl_frm [frame $split_frm.tbl_frm]
set split_table [sparam_table_widget $split_tbl_frm split_table]
#file extensions frame, vars frame & legend
set file_frm [eyes_view_create_file_extention_bar $frm_main $listOfPossibleExtensions]
set var_frm [eyes_view_create_vars_values_bar $frm_main $listOfExternalVarsAndValues]
set legend_frm [eyes_view_create_legend_frame $frm_main]
grid $split_tbl_frm -row 0 -sticky nwse
grid $apply_button -row 1 -sticky nwse
grid columnconfigure $frm_main 0 -weight 0
grid columnconfigure $frm_main 1 -weight 1
grid rowconfigure $frm_main 0 -weight 0
grid rowconfigure $frm_main 1 -weight 0
grid rowconfigure $frm_main 2 -weight 1
grid rowconfigure $frm_main 3 -weight 0
grid rowconfigure $split_frm 0 -weight 1
grid rowconfigure $split_frm 1 -weight 0
...
return [list $g $split_table $legend_frm $frm_main]
}