Re: Help Regarding GUI



On 12 Oct, 14:38, raaki <hemanth...@xxxxxxxxx> wrote:
On 12 Oct, 13:16, Bryan Oakley <oak...@xxxxxxxxxxxxxxxxxxxx> wrote:





raaki wrote:
Hi friends

i am newbie toTcl/Tk .i need some help regarding GUI design with tcl/
tk.i want to design a gui with a List of 5 fields and display it with
default values and intial dir, and when running the script the gui is
displayed such that i can edit (mean a browse option to change files
or direct).

i wrote a script with an array such that i am able to create the GUI
with the required fields and also with browse option,but when i browse
only the fifth label is getting updated .i dont know what error is
behind,can u guys help me to find the error

set listOfFields [list ABSOLUTE_PATH_NAMES ANNOTATE_LOAD_SLEW
BA_DIR BLACKBOXES SUB ]
foreach field $listOfFields {
set f ".frame-$field"
frame $f
button $f.label -width 30 -text "$field:" -bg NavajoWhite2 -fg Navy
-relief raised -command daa

You need to pass the field name to the "daa" command:

button $f.label ... -command [list daa $field]

proc daa {field} {
...
}

please also help me how to fit a scrollbar in the GUI which it
displays when running the script

Tk doesn't include a way to scroll a frame, if that's what you mean.
There are however many solutions to the problem. The easiest is to use a
pre-existing widget such as the bwidget scrolledframe.

http://aspn.activestate.com/ASPN/docs/ActiveTcl/8.4/bwidget/Scrollabl...

There are other solutions, too. For example:

http://wiki.tcl.tk/9223

If you do some searching, you may stumble on the "scrolledframe" that is
part of "iwidgets". I'd recommend avoiding that one because it requires
a whole lot of extra stuff which you probably don't need.

If those don't work for you, you can get the same effect by either using
a canvas or text widget as the scrollable container. Those take slightly
different approach in that you don't pack or grid widgets into them, but
instead use their built-in ability to add windows. That's a bit advanced
for someone just starting out, so I recommend trying the other methods
first.- Hide quoted text -

- Show quoted text -

Hi roland Byran
first of all i want to say thanks for the reply.

i tried as u menctioned in the previous mail but it is showing error
like "variable field already existts"

my edited code is below

set listOfFields [list ABSOLUTE_PATH_NAMES \ANNOTATE_LOAD_SLEW \BA_DIR
\BLACKBOXES \BSUB ]
foreach field $listOfFields {
set f ".frame-$field"
frame $f
button $f.label -width 30 -text "$field:" -bg NavajoWhite2 -fg Navy
-relief raised -command [list daa $field]
label $f.entry -textvariable data -relief sunken -bg NavajoWhite -fg
Navy -anchor nw
pack $f.label -side left
pack $f.entry -side left -fill x -expand 1
pack $f -side top -fill x

}

proc daa {field} {
global data
global initialdir
set data [tk_chooseDirectory -initialdir ~ -title "choose directory"]

}

regards
raaki- Hide quoted text -

- Show quoted text -

hi Roland and Byran

i fixed it.thanks for the help.next target is to fix Scroll bar..Byran
i follow as u said in the prev mail

cheers
raaki

.