如何更改 Treeview 中仅一行的高度? [英] How to change height of only one row in a Treeview?

查看:50
本文介绍了如何更改 Treeview 中仅一行的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Python 创建一个基于 Tkinter 的 GUI,但我不知道如何更改仅一行的高度.我试过这段代码,但它改变了每一行的高度.

I'm creating a Tkinter-based GUI in Python, and I can't find out how to change the height of only one row. I've tried this code, but it changes height of every row.

from tkinter import *
from tkinter.ttk import *


root = Tk()
Style(root).configure("Treeview", rowheight=40)
tree = Treeview(root, style="Treeview")
tree.pack()
for i in range(100):
    tree.insert("", END, i, text=str(i) * i)
root.mainloop()

我也尝试将样式用于某些标签,但不起作用.我怎样才能做我需要的事情?

I've also tried to use the style for certain tags, but it doesn't work. How can I do what I need?

推荐答案

如何更改 Treeview 中仅一行的高度?

How to change height of only one row in a Treeview?

我认为您无法更改单行的高度.树视图被设计为具有统一的行.

I don't think you can change the height of a single row. The treeview was designed to have uniform rows.

这篇关于如何更改 Treeview 中仅一行的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆