Jump to content

Help: Add multiple buttons in frame using TCL/TK.

- - - - -

  • Please log in to reply
No replies to this topic

#1
sip4vinay

sip4vinay

    Newbie

  • Members
  • Pip
  • 1 posts
Hi all,
I am trying to add multiple buttons in frame using TCL/TK.

As in below code, If i am adding more buttons then they will not shown in the frame, as all are added in single line. I wanted to put them in the next line once it reaches to end of frame.

I wanted to put them like below:

-----------------------------
|
| B1 B2 B3 B4 B5 B6 B7
|
| B8 B9 .....
|
-----------------------------


My code :

--------------------------------------

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


set count 0
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
}
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
}

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 "


------------------------
Plz take a look and assist me, thanks in advance.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users