Skip to content

Harry-g25/CTkDataTable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


What is CTkDataTable?

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.


Preview

CTkDataTable Preview

Why Use It?

CustomTkinter Friendly

Designed to fit naturally into modern CustomTkinter applications.

Dictionary Based

Define columns and rows using simple Python dictionaries.

Practical

Built for dashboards, admin tools, database viewers and internal systems.


Features

  • 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

Installation

pip install CTkDataTable

Quick Start

import 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()

How It Works

flowchart LR
    A[Define Columns] --> B[Create Row Data]
    B --> C[Pass Data to CTkDataTable]
    C --> D[Render Table]
    D --> E[Display Structured Data]
Loading

Column Configuration

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

Supported Column Types

Text

For names, labels, descriptions and general values.

Number

For IDs, counts, quantities and numeric data.

Badge

For statuses, permissions, categories and priority labels.

Text Column

{
    "key": "name",
    "title": "Name",
    "width": 160,
    "type": "text"
}

Number Column

{
    "key": "id",
    "title": "ID",
    "width": 60,
    "type": "number"
}

Badge Column

{
    "key": "permission",
    "title": "Permission",
    "width": 140,
    "type": "badge",
    "badge_colors": {
        "Admin": "red",
        "Manager": "blue",
        "Standard": "gray"
    }
}

Row Data

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.


Use Cases

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

Project Status

CTkDataTable is currently in development.

It is being improved through practical use in real CustomTkinter desktop application projects. Feedback, issues and suggestions are welcome.


Contributing

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.


Licence

This project is released under the MIT Licence.


Links


Built for clean, practical CustomTkinter applications.

About

A modern and configurable data table widget for CustomTkinter, designed for building cleaner desktop apps, dashboards and database-driven tools.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages