Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
embedded form

Posted by dee00zee (dee00zee), 28 June 2005
I have 2 forms, main and input form.Input form is execute from the main form.Data from both forms are to be saved in the same file i.e file1.

The problem here is I couldn't save the file correctly unless I run the two forms separately.

I want to run the second form (input) from the main form and save the data to the same file.Any suggestion on how to do this?

Go through my code to see what went wrong

First form (main)

proc mormal { } {
global choice path cho8 IN
     puts $IN "set $choice \"$path\""
     if {$choice=="Yes"} {
           puts $IN "set $choice.value \"$path\" "
     puts $IN "set Input2 \"$cho8\" "      


frame .top -borderwidth 5
pack .top -side top -fill x

entry .top.ent -width 30 -relief sunken -background white -textvariable path
radiobutton .top.rad1 -text Yes -variable choice -value Yes -command { .top.ent config -state normal}
radiobutton .top.rad2 -text No -variable choice -value No -command {.top.ent config -state disable}
.top.ent config -state normal            
label .top.lab -text "Input" -pady 2

pack .top.ent -side right -padx 10
pack .top.lab -side left
pack .top.rad1 .top.rad2 -side left

frame .top1 -borderwidth 5
pack .top1 -side top -fill x
#entry $v.f$a8.ent -width 30 -relief sunken -background white -textvariable pat8 -state normal
radiobutton .top1.rad9 -text Timing -variable cho8 -value Timing
radiobutton .top1.rad10 -text Congestion -variable cho8 -value Congestion
label .top1.lab1 -text "Input2  " -pady 2

#pack $v.f$a8.ent -side right -fill x -pady 5
pack .top1.lab1 -side left
pack .top1.rad9 .top1.rad10 -side left -padx 3

set IN [open file1 "a"]

button .save -text Save.. -command mormal
button .user -text {User input} -command {exec "input"}
button .quit -text Quit -command exit

pack .quit .save .user -side right

Second form (input)

     set IN [open file1 "a"]
     frame .inputs -borderwidth 5
           label .inputs.label -text Inputs
           pack .inputs -side top -fill x
           pack .inputs.label -side top
     frame .k -relief flat -borderwidth 15
           pack .k -side top -fill x
           set element {Name Passport Phone}
           foreach item $element {
           frame .k.f$item -borderwidth 2 -relief groove
           pack .k.f$item -side top -fill x
           label .k.f$item.l -text " $item"  -pady 2 -width 14 -anchor w
           label .k.f$item.l2 -text :
           entry .k.f$item.e -width 30 -relief sunken -bg white -textvariable line($item) -width 45
           pack .k.f$item.l -side left
           pack .k.f$item.l2 -side left
           pack .k.f$item.e -side bottom -pady 5
           button .save -text Save.. -command save
           button .quit -text Quit -command exit
           pack .save -side right
           proc save { } {
           global IN element .k
           foreach m $element {
           if {[.k.f$m.e get] != ""} {
                 puts $IN "set $m \"[.k.f$m.e get]\""
                 puts $IN ""

Posted by admin (Graham Ellis), 29 June 2005
Oh help ... big piece of code and I'm on the road today and tomorrow ... I'll revisit this thread on Friday

Posted by admin (Graham Ellis), 2 July 2005
Having re-visited this ... I think there might be an easy answer to a l-o-n-g example and question.  If you want two forms, one after the other, each in their own separate window, then set up the second (and any subsequent ones if you have them) in a toplevel widget.  

You can use the wm command (I think the options are withdraw and deiconify) to remove and to (re)display the windows as you need them to be unavailable / available.  The wm command also lets you size, reposition and limit the size and aspect ratio of top level widgets.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho