How to make Tkinter columns of equal width when widgets span multiple columns (Python 2.7)

后端 未结 3 1785
Happy的楠姐
Happy的楠姐 2021-01-19 12:22

In the following, the buttons labelled \'ONE\', \'TWO\', and \'THR\' do not get evenly spaced out. It seems to me that the root of the problem is that Tk is assuming a defau

3条回答
  •  情歌与酒
    2021-01-19 12:33

    import tkinter
    
    master = tkinter.Tk()
    
    tkinter.Button(master, text='ONE                ').grid(row=0, column=3, sticky='NW')
    tkinter.Button(master, text='TWO               ').grid(row=1, column=3, sticky='NW')
    tkinter.Button(master, text='THR                ').grid(row=2, column=3, sticky='NW')
    tkinter.Button(master, text='FOU                ').grid(row=3, column=3, sticky='NW')
    tkinter.Text(master).grid(column=30, columnspan=10)
    

提交回复
热议问题