Python 3.x Tkinter-使列自动调整为最长字段值
我正在做一个简单的库存管理系统。我希望将列自动调整为列中的Python 3.x Tkinter-使列自动调整为最长字段值,python-3.x,tkinter,Python 3.x,Tkinter,我正在做一个简单的库存管理系统。我希望将列自动调整为列中的最长字段值。这是当前的解决方案。我希望它是这样的 这是我初始化treeview的方式: self.tree = ttk.Treeview (height = 15, columns = ('amount', 'size','price','status','best','comment')) self.tree.grid (row = 9, column = 0, columnspan =
最长字段值。这是当前的解决方案。我希望它是这样的
这是我初始化treeview的方式:
self.tree = ttk.Treeview (height = 15, columns = ('amount',
'size','price','status','best','comment'))
self.tree.grid (row = 9, column = 0, columnspan = 7)
self.tree.heading ('#0', text = 'Varenavn', anchor = W)
self.tree.heading ('amount', text = 'Antall', anchor = W)
self.tree.heading ('size', text = 'Størrelse', anchor = W)
self.tree.heading ('price', text = 'Pris', anchor = W)
self.tree.heading ('status', text = 'Status', anchor = W)
self.tree.heading ('best', text = 'Best før', anchor = W)
self.tree.heading ('comment', text = 'Kommentar', anchor = W)
我已经读到,列的默认值是我想要的行为。我做错了什么?任何帮助都将不胜感激 请提供一个可测试的例子。一些基本的GUI和您的导入。