TreeviewEx
Treeview extension for Tkinter.
This package adds the following features to the standard tkinter Treeview:
- Vertical and horizontal scroll bars
- Cell editing
- Read-only settings for rows, columns, and cells
All other behavior is the same as the standard tkinter Treeview.
Testing
-
Install dependencies
uv sync --group dev
-
Run the tests
uv run pytest -q
-
Show coverage report
uv run coverage run -m pytest -q uv run coverage report -m
-
Generate an HTML report (optional)
uv run coverage html
Build
-
Install dependencies
uv sync --group dev
-
Build the package
uv build -
Check the generated wheel in the dist folder
Usage
-
Install the package
uv pip install path/to/TreeviewEx.whl
-
Run the sample
uv run python sample/sample.py
Example:
from treeviewex import TreeviewEx
from tkinter import Tk
root = Tk()
root.title("TreeviewEx Example")
treeview_ex = TreeviewEx(root)
treeview_ex.grid(row=0, column=0, sticky="nsew")
columns = ("col1", "col2", "col3", "col4")
treeview_ex["columns"] = columns
treeview_ex.heading("#0", text="", anchor="w")
treeview_ex.column("#0", width=0, stretch=False)
for col in columns:
treeview_ex.heading(col, text=f"{col.capitalize()}")
treeview_ex.column(col, width=100)
for i in range(100):
treeview_ex.insert(
"",
"end",
text="",
values=(f"Value {i}A", f"Value {i}B", f"Value {i}C", f"Value {i}D"),
)
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
root.mainloop()
Public interfaces
set_readonly_row(row_id: str, readonly: bool = True) -> None
Set the specified row to readonly.
set_readonly_column(column_id: str, readonly: bool = True) -> None
Set the specified column to readonly.
set_readonly_cell(cell_id_pair: tuple, readonly: bool = True) -> None
Set the specified cell to readonly.
set_combobox_row(row_id: str, values: list = None, is_combobox: bool = True) -> None
Set the specified row to be editable with a Combobox.
set_combobox_column(column_id: str, values: list = None, is_combobox: bool = True) -> None
Set the specified column to be editable with a Combobox.
set_combobox_cell(cell_id_pair: tuple, values: list = None, is_combobox: bool = True) -> None
Set the specified cell to be editable with a Combobox.
License
This project is licensed under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treeviewex-1.0.0.tar.gz.
File metadata
- Download URL: treeviewex-1.0.0.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4a0f143c818f1912dcaf9dac3c02d103f1d91d4d99e15d947ec1a25e9e121af
|
|
| MD5 |
3d87b197840dc47c85e40419bcc274b9
|
|
| BLAKE2b-256 |
8d3911e42648a6ed58892f55d6991a4057f24bf4f88e751bb77a8d9a682ed84b
|
File details
Details for the file treeviewex-1.0.0-py3-none-any.whl.
File metadata
- Download URL: treeviewex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee65124434944c7a2e091c21d24c8f83fb661fd8ad425db76b17617d217fcdf5
|
|
| MD5 |
61f228c718b85c8d375e143634101611
|
|
| BLAKE2b-256 |
21b2ce16f1faba96435c151f2a3bdb889c856030bdb6f713562bb56122580137
|