我想禁用列大小调整,但是“stretch=False”不起作用,我不知道为什么,我的python3.4.3版本。在
from tkinter import *
from tkinter import ttk
def main():
gMaster = Tk()
w = ttk.Treeview(gMaster, show="headings", columns=('Column1', 'Column2'))
w.heading('#1', text='Column1', anchor=W)
w.heading('#2', text='Column2', anchor=W)
w.column('#1', minwidth = 70, width = 70, stretch = False)
w.column('#2', minwidth = 70, width = 70, stretch = False)
w.grid(row = 0, column = 0)
mainloop()
if __name__ == "__main__":
main()
尝试在mainloop()之前添加此项
你不需要拉伸=假
下面是一个带注释的演示。尝试改变拉伸的值和改变应用程序窗口的宽度,你会看到区别。也许没有必要阻止用户调整列的大小。相反,更重要的是给每个列一个适当的初始宽度,以便可以轻松地显示其内容。在
相关问题 更多 >
编程相关推荐