CTkTable
CTkTable copied to clipboard
Function to update the command for all or individual cells.
I have seen a couple of people run into issues trying to alter the command attached to the table because it can only be assigned upon table creation.
Could something be implemented so that you can dynamically update the command? I know that updating the command on individual cells might not play well. But a mass update or ability to attach a command post creation would be nice.
For example:
def update_cell_commands(self, new_command):
""" Updates the 'command' attribute of all CTkButtons within the CTkTable. """
# Loop through all buttons in the table
for i in range(self.rows):
for j in range(self.columns):
self.frame[i,j].configure(command=lambda e=self.data[i, j]: new_command(e))
Let me know if this is something that seems feasible! I don't mind looking into making a more comprehensive function.