我想在窗口中的两个帧之间放一个分隔符。我想使用ttk::separator。
我的代码是:
proc create_layout_changing_frame {} {
set ch_frm ".prop_menu.main_frame.changing_frame"
global _PROP
global _DB
global _prop_attr
set _frame_row 0
set _size_text_lbl 20
set _size_full_entry 85
set _size_brw_button 3
# The layout file frame
set frm [frame $ch_frm.layout_file]
set lbl [label $ch_frm.layout_file.label -text "Layout file:" -width $_size_text_lbl]
set entr [entry $ch_frm.layout_file.entry -textvariable _prop_attr(layout_file) -width [expr $_size_full_entry-$_size_brw_button]]
set browse [button $ch_frm.layout_file.browse -image icon_browse -command {get_layout_file}]
set sep [label $ch_frm.layout_file.blank -text ""]
grid $lbl -row 1 -column 1 -sticky nsw
grid $entr -row 1 -column 2 -sticky nse
grid $browse -row 1 -column 3 -sticky nsw
grid $sep -row 2 -column 1 -sticky nsw -columnspan 3
grid $frm -row [incr _frame_row] -column 1 -sticky nsew
# The input instance frame
# if not root - root isn't driven
if {$_DB(blocks,$_prop_attr(block),father) != -1} {
set frm [frame $ch_frm.input_instance]
set lbl [label $ch_frm.input_instance.label -text "Input Instance:" -width $_size_text_lbl]
set warn [label $ch_frm.input_instance.warn -text "" -fg "red"]
set entr [entry $ch_frm.input_instance.entry -textvariable _prop_attr(input_instance) -width $_size_full_entry -validate focusout -vcmd {check_input_instance}]
grid $lbl -row 1 -column 1 -sticky nsw
grid $entr -row 1 -column 2 -sticky nse
grid $warn -row 2 -column 1 -sticky nsew -columnspan 2
grid $frm -row [incr _frame_row] -column 1 -sticky nsew
}
# The output instance frame
set frm [frame $ch_frm.output_instance]
set lbl [label $ch_frm.output_instance.label -text "Output Instances:" -width $_size_text_lbl]
set warn [label $ch_frm.output_instance.warn -text "" -fg "red"]
set entr [entry $ch_frm.output_instance.entry -textvariable _prop_attr(output_instance) -width $_size_full_entry -validate focusout -vcmd {check_output_instance}]
grid $lbl -row 1 -column 1 -sticky nswe
grid $entr -row 1 -column 2 -sticky nse
grid $warn -row 2 -column 1 -sticky nsew -columnspan 2
grid $frm -row [incr _frame_row] -column 1 -sticky nsew
# The driving instance frame
... There is a full definition of a frame here, it's a little complicated so I don't put it, But it works fine...
# The power and ground pattern frame
set sep [ttk::separator $ch_frm.separator1 -orient horizontal]
set frm [frame $ch_frm.pwd_gnd_pattern]
set lblpow [label $ch_frm.pwd_gnd_pattern.powlbl -text "Power Pattern:" -width $_size_text_lbl]
set entrpow [entry $ch_frm.pwd_gnd_pattern.powentr -textvariable _prop_attr(power_pattern) -width $_size_full_entry]
set sep [label $ch_frm.pwd_gnd_pattern.blank -text ""]
set lblgnd [label $ch_frm.pwd_gnd_pattern.gndlbl -text "Ground Pattern:" -width $_size_text_lbl]
set entrgnd [entry $ch_frm.pwd_gnd_pattern.gndentr -textvariable _prop_attr(ground_pattern) -width $_size_full_entry]
grid $lblpow -row 1 -column 1 -sticky nsw
grid $entrpow -row 1 -column 2 -sticky nse
grid $sep -row 2 -column 1 -sticky nswe -columnspan 2
grid $lblgnd -row 3 -column 1 -sticky nsw
grid $entrgnd -row 3 -column 2 -sticky nse
grid $sep -row [incr _frame_row] -column 1 -sticky ew -pady 4
grid $frm -row [incr _frame_row] -column 1 -sticky nsew
make_all_layout_checks
}
分隔符根本没有显示在窗口上,这是一张图片。最重要的是它现在看起来如何,在底部,一个红色圆圈表示我想放置分隔符的位置。
此外,给定的代码仅处理带凹槽边框内的框架,所有其他元素都在其他地方处理。
问题出在哪里?
答案 0 :(得分:1)
您可以在label $ch_frm.pwd_gnd_pattern.blank
变量中将另一个小部件的名称(sep
)存储在下面的几行中。这样可以阻止分隔符显示。