https://github.com/johndevlopment/ctktreeview
A Treeview widget for customtkinter (extension/add-on)
https://github.com/johndevlopment/ctktreeview
customtkinter customtkinter-widgets tkinter-gui tkinter-widgets
Last synced: 3 months ago
JSON representation
A Treeview widget for customtkinter (extension/add-on)
- Host: GitHub
- URL: https://github.com/johndevlopment/ctktreeview
- Owner: JohnDevlopment
- License: mit
- Created: 2024-08-14T22:11:25.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T19:55:09.000Z (10 months ago)
- Last Synced: 2024-08-19T23:23:16.212Z (10 months ago)
- Topics: customtkinter, customtkinter-widgets, tkinter-gui, tkinter-widgets
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CTkTreeview
A Treeview widget for customtkinter (extension/add-on).This package is built off of the idea from https://github.com/TomSchimansky/CustomTkinter/discussions/1821. Credit goes to @avalon60 for the idea.
## Installation
Since there are no source or wheel distributions, you can install directly from Github.```sh
pip install git+https://github.com/JohnDevlopment/CTkTreeview.git
```
## Usage
Calling the package directly brings up a demo of the Treeview.
Double-clicking an item lets you edit it. Press Enter to apply the change. Press Escape or focus ouf of the entry to cancel the edit.

### In Code
Now to the point of using `CTkTreeview` in code, here is a snippet:```python
from CTkTreeview import CTkTreeview
from customtkinter import CTkapp = CTk()
tree = CTkTreeview(app, height=25, columns=["First", "Last", "Age"], width=500, show="headings")
tree.grid(row=0, column=0)
...
app.mainloop()
```This creates a treeview with three columns named "First", "Last", and "Age". It is configured to show only the headings.
To configure the headings, use `headings()`.
```python
with tree.headings() as th:
th.text("First", "First Name")
th.text("Last", "Last Name")
th.text("Age", "Age")
```To configure the columns, use `columns()`.
```python
with tree.columns() as tc:
tc.minwidth("First", 150)
tc.minwidth("Last", 150)
tc.anchor("Age", "e")
```## Documentation
Documentation is planned for a future update once the code is more or less finished.