I am a complete newbie in the tcl / tk world, but I tried to explore this on my own and continue to be empty.
I am expanding the tcl / tk application that allows me to add code to create a child window and do what I need. The problem is that when I create this window and try to set the default value for my input widget, it always appears empty.
Since then I have created an ultra simple demo application to reproduce this:
#!/usr/local/bin/wish set myvar1 "initial value 1" entry .entry1 -textvariable myvar1 button .spawnchild -text "Spawn Child" -command "spawn_click" pack .entry1 .spawnchild proc spawn_click {} { set myvar2 "initial value 2" toplevel .lvl2 entry .lvl2.entry2 -textvariable myvar2 entry .lvl2.entry3 -textvariable myvar1 pack .lvl2.entry2 .lvl2.entry3 }
As you can see, the first window contains an input widget that has a default value of "initial value 1" and it displays correctly. When I click the "Spawn Child" button, a child window is created. As you can see, it has two built-in widgets. Each of them has a default value, and the first - using the default value that was created in its own area, and the entries below, using the default value in the main program area.
The problem is that the top input box for some reason does not show the default value, and the bottom one is just fine.

Can someone explain this behavior and how to get the widget with the top row to correctly display its default value?
EDIT
Thanks Andrew and schlenk, it seems like this was the case of RTFM :) I checked your global suggestions and worked as promised. Thanks for setting me straight!
source share