Daba
Daba

Reputation: 11

How to set the row height of data rows of ttkbootstrap.tableview.Tableview (bootstrap.TableView NOT tk.TreeView)?

This question is not a duplicate of How can I set the row height in Tkinter TreeView? because I am asking about ttkboostrap.tableview.Tableview and not tk.Treeview. The Treeview solutions do not work for Tableview.

I cannot set the row height of ttkbootstrap.tableview.Tableview data rows. I can change the heading but not the data rows.

import ttkbootstrap as ttk
from ttkbootstrap.tableview import Tableview
from ttkbootstrap.constants import *

app = ttk.Window()
style = app.style
**style.configure('Treeview.Heading', rowheight=80, font=(None, 18))
style.configure('Treeview', rowheight=80, font=(None, 18))**

coldata = [{"text": "LNum", "stretch": False}, "CompanyName", {"text": "UserCount", "stretch": False}, ]
rowdata = [('A123', 'IzzyCo', 12), ('A136', 'Kimdee Inc.', 45), ('A158', 'Farmadding Co.', 36)]

dt = Tableview(
    master=app,
    coldata=coldata,
    rowdata=rowdata,
    paginated=True,
    searchable=True
)
dt.pack(fill=BOTH, expand=YES, padx=10, pady=10)
dt.load_table_data()
app.mainloop()

I expect the data row height to increase in height but it does not.

Upvotes: 1

Views: 362

Answers (1)

J. Kitchens
J. Kitchens

Reputation: 1

This worked for me:

style.map("Treeview", rowheight=[("!disabled", 25)])

Replace the height value, 25, with your desired height.

Upvotes: 0

Related Questions