Tkinter网格填充空白空间

在发布之前,我确实搜索了很多示例,但仍然无法正确使用tkinter网格。

我想要的是:

http://img3.mukewang.com/60b5f4d20001717203330280.jpg

我的代码:


import tkinter as tk

from tkinter import ttk


root = tk.Tk()


b1 = ttk.Button(root, text='b1')

b1.grid(row=0, column=0, sticky=tk.W)


e1 = ttk.Entry(root)

e1.grid(row=0, column=1, sticky=tk.EW)


t = ttk.Treeview(root)

t.grid(row=1, column=0, sticky=tk.NSEW)


scroll = ttk.Scrollbar(root)

scroll.grid(row=1, column=1, sticky=tk.E+tk.NS)


scroll.configure(command=t.yview)

t.configure(yscrollcommand=scroll.set)


root.columnconfigure(0, weight=1)

root.columnconfigure(1, weight=1)

root.rowconfigure(1, weight=1)


root.mainloop()


阿晨1998
浏览 183回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python