我正在用 tkinter 编写一个应用程序,我试图在一个框架中放置几个标签......不幸的是,
windowTitle=Label(... width=100)
和
windowFrame=Frame(... width=100)
是非常不同的宽度...
到目前为止,我使用以下代码:
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
出于某种原因,设置标签宽度不能正确设置宽度,或者不使用像素作为测量单位......那么,有没有办法以windowTitle
适应框架长度的方式放置小部件,或者以像素为单位设置标签宽度?