Re: Can't manage ... it's a top-level window
- From: Bryan Oakley <oakley@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 14:16:27 -0600
vnpenguin wrote:
Hi all,
I'm newbie to Tcl/Tk. Just install ActiveTcl8.4.16.0.282109 on my
Win2k box. I'm try now the follow code:
=========================================
set FR0 [ labelframe .fr0 -text "Test" ];
set lb1 [ label $FR0.name1 -text "Name:" ];
set op_menu1 [ tk_optionMenu $FR0.op1 v_op1 "A" "B" "C" ];
set lb2 [ label $FR0.name2 -text "Name2::" ];
set op_menu2 [ tk_optionMenu $FR0.op2 v_op2 "X" "Y" "Z" ];
grid $lb1 $op_menu1 -row 1
grid $lb2 $op_menu2 -row 2
pack $FR0
=========================================
But when I run I got error:
Can't manage ".fr0.op1.menu": it's a top-level window
while executing
"grid $lb1 $op_menu1 -row 1"
(file "test01.tcl" line 8)
Anyone could tell me how to fix that please,
The option menu widget you want to pack is $FR0.op1 and $FR0.op2. What tk_optionMenu returns is not that widget but the menu widget inside that widget. Yes, it's inconsistent with other widgets, but it's documented that way.
So, do it this way:
grid $lb1 $FR0.op1 -row 1
grid $lb2 $FR0.op2 -row 2
--
Bryan Oakley
http://www.tclscripting.com
.
- References:
- Can't manage ... it's a top-level window
- From: vnpenguin
- Can't manage ... it's a top-level window
- Prev by Date: Re: Can't manage ... it's a top-level window
- Next by Date: Re: Can't manage ... it's a top-level window
- Previous by thread: Re: Can't manage ... it's a top-level window
- Index(es):
Relevant Pages
|