Re: Help Regarding GUI



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/ScrollableFrame.html

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.
.


Quantcast