Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Grid

Status
Not open for further replies.

GreatDantone

Programmer
Apr 13, 2010
5
CA
Hi, I am trying to to put to frames side by side in my toplevel window. But grid doesn't seem to work with frames. Here's my code:

# Location search fields
frame .loc

set location_fields {City Country}

foreach field $location_fields {
label .loc.lab$field -text $field
entry .loc.ent$field -textvariable form($field)
grid .loc.lab$field .loc.ent$field -sticky news -padx 10 -pady 7
}

# Search types
frame .typ

set search_types {Hotels Restaurants Attractions}

foreach type $search_types {
checkbutton .typ.rb$type -text $type -variable form($type)
pack .typ.rb$type
}

grid .loc .typ





I don't get any error message. Wish appears to be running, but nothing shows on the screen.

If instead of "grid .loc .typ", I use "pack .loc .typ" it works, but I don't know how to put the two frames side by side.


Thanks
 
Last question first: how to pack 2 frames side by side:
Code:
pack [frame .f1 -borderwidth 4] -side left
pack [frame .f2 -borderwidth 4] -side left

Now to grid. In my limited experience, the grid manager can be tricky. Consider this:
Code:
% frame .f1 -borderwidth 4 -relief groove
.f1
() 2 % frame .f2 -borderwidth 4 -relief groove
.f2
() 3 % grid .f1 -row 0 -column 0
() 4 % grid .f2 -row 0 -column 1
() 5 % grid [label .f1.l1 -text "label 1"] -row 0 -column 0
() 6 % grid [label .f2.l1 -text "label 2"] -row 0 -column 0
() 7 % grid [label .f1.l2 -text "label 3"] -row 0 -column 1
() 8 %
I find it best to explicitly assign column and row when using grid.

_________________
Bob Rashkin
 
Thanks a lot, It still have the same problem when I try to grid the two frames. But now I can make it work with pack, so problem solved!


 
What if you grid your checkbuttons?

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top