Version 4 of Need Help: TCL\TK - adding multiple buttons in frame

Updated 2010-07-26 19:49:58 by sipvinay

hi All,

I am trying to add buttons in the frame Using TCL/Tk langauge. I am able to create farme and add button in it. the problem is that, if i am keep adding the buttons in the frame then they will not appear in the frame after some count, I wanted them to come in the next line once it reaches to frame size.

Please advice me, what shoud i do to solve the problem. Thanks in advance.

my code snip:

wm title . "Toolbar Demonstration" 
wm geometry . 325x100

                
set count 0
# adding frame 
proc add_frame title {
  global frame count w
  set frame .frame$count
  frame $frame -border 2 -relief groove
  label $frame.label -text $title
  pack  $frame       -side left -padx 2 -pady 2 -anchor n -fill x
  pack  $frame.label -side top  -padx 2 -pady 2
  incr count
}
# adding button
proc add_button {title} {
  global frame count
  button $frame.$count -text $title 
  pack   $frame.$count -side left -pady 1 -padx 3 -fill x
  incr count
}

# calling the proc.
add_frame  "Button Set1" 
add_button "  B1  " 
add_button "  B2  " 
add_button "  B3  "
add_button "  B4  "
add_button "  B5  "
add_button "  B6  "
add_button "  B7  "
add_button "  B8  "
add_button "  B9  "