python-3.x - Tkinter - 使列自动调整为最长的字段值
问题描述
我正在制作一个简单的库存管理系统。我希望列自动调整为longest field value
列中的。这是当前的解决方案。我希望它是这样的。
这就是我初始化树视图的方式:
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)
我读过一列的默认值是我想要的行为。我在这里做错了什么?任何帮助将不胜感激!
解决方案
推荐阅读
- javascript - Vuex - 不要在突变处理程序之外改变 vuex 存储状态。状态在突变内部改变
- c++ - 是否可以在 C++ DLL 项目中使用 boost 库?
- javafx - JavaFX 组合框的起始值?
- git - 如何在别名 git 命令时防止“致命”错误输出
- sql - Django对同一字段进行多对一反向查询
- node.js - 如何更新用户权限discord js
- r - 将 3 个箱线图绘制成一个图
- meteor - 贝宝没有重定向到贝宝网站,但墨迹正在流星的响应中
- databricks - 如何在现有数据库之上创建具有只读访问权限的 databricks 数据库
- javascript - 在浏览器中按下后退按钮时,如何在不重定向到登录页面的情况下显示弹出窗口?