每当我更换显示器时,如何调整标签宽度

时间:2015-08-29 04:56:50

标签: python tkinter

我正在使用此代码使用Tkinter开发布局。我使用的分辨率为1600 x 900的屏幕。但我也想在不同的显示器中使用相同的布局。但是根据屏幕尺寸,布局会变得越来越小。我想通过屏幕更改动态更新布局。

from tkinter import *
root = Tk()
root.geometry("1600x900+0+0") 

Label(root,text='xyz', background='blue', foreground='cyan', font=("Times New Roman",60),borderwidth=4,width=7,height=1,relief='raised').grid(row=0,column=0)
Label(root,text='abc', background='blue', foreground='cyan', font=("Times New Roman",60),borderwidth=4,width=17,relief='raised').grid(row=0,column=1)
Label(root,text='pqr', background='blue', foreground='cyan', font=("Times New Roman",60),borderwidth=4,width=5,relief='raised').grid(row=0,column=2)
Label(root,text='stu', background='blue', foreground='cyan', font=("Times New Roman",60),borderwidth=4,width=3,relief='raised').grid(row=0,column=3)
Label(root,text='i', background='blue', foreground='cyan', font=("Times New Roman",60),borderwidth=4,width=3,relief='raised').grid(row=0,column=4)   

0 个答案:

没有答案