[Tutor] How to make the label left justified in a frame
klappnase at freenet.de
Thu Nov 23 17:15:10 CET 2006
On Thu, 23 Nov 2006 14:14:59 +0000
"Asrarahmed Kadri" <ajkadri at googlemail.com> wrote:
> Hi Folks,
> I am using grid manager inside a frame to arrange 4 label widgets, one
> beneath the other.
> What I want is that all teh labels should be placed in the left of the
> There is no effect of using sticky = W.
> Please help ; is it possible to do it with anchor..???
> I have the follwng code:
> frame3 = Frame(root,relief='sunken',bd=2)
> label_st_date = Label(frame3,text='Start Date:',font=font_object2)
> label_ed_date = Label(frame3,text='End Date:')
> label_st_time = Label(frame3,text='Start Time:')
> label_ed_time = Label(frame3,text='End Time:')
sticky=W does put the labels to the frame's left side; the problem is that
the frame's grid column does not expand beyond the requested size of the labels.
To fix this, you need to call: frame3.grid_columnconfigure(0, weight=1)
(similar to pack(fill=X, expand=True)).
I hope this helps
More information about the Tutor