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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using -fill with a frame

Status
Not open for further replies.

Bones3

Programmer
Jul 27, 2003
151
US
So...
I have this cute little listbox packed at the bottom of my gui.

Code:
listbox .transferBuffer -height 6
pack .transferBuffer -side bottom -fill x

This worked great, until I had this crazy idea that adding a scrollbar would make the users happy.

Code:
frame .buffer
listbox .buffer.transferBuffer -height 6 -yscroll ".buffer.scrollY set"
scrollbar .buffer.scrollY -command ".buffer.transferBuffer yview" -orient v

pack .buffer -side bottom -fill x
pack .buffer.transferBuffer -side left
pack .buffer.scrollY -fill y -side left

The problem with this is that the frame (.buffer) doesn't fill up the bottom of my gui anymore. There is no behavior difference in:

pack .buffer -side bottom -fill x
and
pack .buffer -side bottom

except that the frame locates itself to the left when the "-fill" option is used. So how do I get a frame to take up all of the x space since -fill x doesn't work?

-Bones
 
Through much thinkering and (unfortunately) little thinking, I found that the -fill option was doing its job -- it just didn't seem like it. The frame (.buffer) was invisible so stretching it to fill the area made no noticable difference. To cause the contents of the frame to fill up all the space properly, I had to use -expand.

Code:
frame .buffer
listbox .buffer.transferBuffer -height 6 -yscroll ".buffer.scrollY set"
scrollbar .buffer.scrollY -command ".buffer.transferBuffer yview" -orient v

pack .buffer -side bottom -fill x
pack .buffer.transferBuffer -side left -fill x -expand 1
pack .buffer.scrollY -fill y -side right

Expand causes items inside to fill up the space of their parent frame.

-Bones
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top