11
I'm writing an app with tkinter and I am trying to put several labels in a frame... Unfortunately,
windowTitle=Label(... width=100)
and
windowFrame=Frame(... width=100)
are very different widths...
So far, I use this code:
windowFrame=Frame(root,borderwidth=3,relief=SOLID,width=xres/2,height=yres/2)
windowFrame.place(x=xres/2-160,y=yres/2-80)
windowTitle=Label(windowFrame,background="#ffa0a0",text=title)
windowTitle.place(x=0,y=0)
windowContent=Label(windowFrame,text=content,justify="left")
windowContent.place(x=8,y=32)
...
#xres is screen width
#yres is screen height
For some reason, setting label width doesn't set width correctly, or doesn't use pixels as measurement units... So, is there a way to place windowTitle widget in such way that it adapts to the lenght of the frame, or to set label width in pixels?