Here is a quick and simple table widget having all the basic features.
pip install CTkTable
Dont forget to leave a ⭐
import customtkinter
from CTkTable import *
root = customtkinter.CTk()
value = [[1,2,3,4,5],
[1,2,3,4,5],
[1,2,3,4,5],
[1,2,3,4,5],
[1,2,3,4,5]]
table = CTkTable(master=root, row=5, column=5, values=value)
table.pack(expand=True, fill="both", padx=20, pady=20)
root.mainloop()
here, args means ctkbutton parameters which can also be passed
Note: treat all the table cells as a ctkbutton class
Parameter | Description |
---|---|
master | parent widget |
values | the default values for table |
row | optional, set number of default rows |
column | optional, set number of default columns |
padx | add internal padding in x |
pady | add internal padding in y |
colors | set two fg_colors for the table (list), eg: colors=["yellow", "green"] |
color_phase | set color phase based on rows or columns, eg: color_phase="vertical" |
orientation | change the orientation of table, vertical or horizontal |
header_color | define the topmost row color |
corner_radius | define the corner roundness of the table |
hover_color | enable hover effect on the cells |
wraplength | set the width of cell text |
justify | anchor the position of the cell text |
command | specify a command when a table cell is pressed, [returns row, column, value] |
*other button parameters | all other ctk button parameters can be passed |
Note: This library is at early stage so there can be some performance issues.