CTkDataTable is a Python module for building cleaner, more practical data tables inside customtkinter desktop applications.
It was created to solve a common problem: CustomTkinter is great for modern desktop interfaces, but displaying structured table data can still be awkward. Standard Tkinter options such as ttk.Treeview often feel dated, difficult to style, or out of place in a modern UI.
CTkDataTable provides a configurable table widget designed for internal tools, dashboards, admin panels, database applications and workflow software.
|
Designed to fit naturally into modern CustomTkinter applications. |
Define columns and rows using simple Python dictionaries. |
Built for dashboards, admin tools, database viewers and internal systems. |
- Built for
customtkinter - Simple column configuration
- Row data passed as dictionaries
- Configurable column titles
- Configurable column widths
- Text columns
- Number columns
- Badge columns
- Cleaner alternative to
ttk.Treeview - Useful for desktop dashboards and database-driven apps
pip install CTkDataTableimport customtkinter as ctk
from CTkDataTable import CTkDataTable
app = ctk.CTk()
app.title("CTkDataTable Example")
app.geometry("900x500")
columns = [
{
"key": "id",
"title": "ID",
"width": 50,
"type": "number"
},
{
"key": "first_name",
"title": "First Name",
"width": 140,
"type": "text"
},
{
"key": "last_name",
"title": "Last Name",
"width": 140,
"type": "text"
},
{
"key": "position",
"title": "Position",
"width": 180,
"type": "text"
},
{
"key": "permission",
"title": "Permission",
"width": 140,
"type": "badge",
"badge_colors": {
"Admin": "red",
"Manager": "blue",
"Standard": "gray"
}
}
]
rows = [
{
"id": 1,
"first_name": "Harry",
"last_name": "Gomm",
"position": "Manager",
"permission": "Manager"
},
{
"id": 2,
"first_name": "Ben",
"last_name": "Jones",
"position": "Engineer",
"permission": "Standard"
},
{
"id": 3,
"first_name": "Charlie",
"last_name": "Smith",
"position": "Admin",
"permission": "Admin"
}
]
table = CTkDataTable(
master=app,
columns=columns,
rows=rows
)
table.pack(fill="both", expand=True, padx=20, pady=20)
app.mainloop()flowchart LR
A[Define Columns] --> B[Create Row Data]
B --> C[Pass Data to CTkDataTable]
C --> D[Render Table]
D --> E[Display Structured Data]
Columns are defined using dictionaries.
columns = [
{
"key": "first_name",
"title": "First Name",
"width": 140,
"type": "text"
}
]| Property | Description |
|---|---|
key |
The key used to match data from each row |
title |
The text displayed in the table header |
width |
The width of the column |
type |
The column display type |
|
For names, labels, descriptions and general values. |
For IDs, counts, quantities and numeric data. |
For statuses, permissions, categories and priority labels. |
{
"key": "name",
"title": "Name",
"width": 160,
"type": "text"
}{
"key": "id",
"title": "ID",
"width": 60,
"type": "number"
}{
"key": "permission",
"title": "Permission",
"width": 140,
"type": "badge",
"badge_colors": {
"Admin": "red",
"Manager": "blue",
"Standard": "gray"
}
}Rows are passed as a list of dictionaries.
rows = [
{
"id": 1,
"first_name": "Harry",
"last_name": "Gomm",
"position": "Manager",
"permission": "Manager"
}
]Each row key should match the key value defined in the column configuration.
CTkDataTable can be used for:
- Admin panels
- User management screens
- Database viewers
- Desktop dashboards
- CRUD applications
- Job management tools
- Stock or asset registers
- Reporting interfaces
CTkDataTable is currently in development.
It is being improved through practical use in real CustomTkinter desktop application projects. Feedback, issues and suggestions are welcome.
Contributions are welcome.
If you find a bug, have an idea for a feature, or want to improve the documentation, feel free to open an issue or submit a pull request.
This project is released under the MIT Licence.