Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to update the command for all or individual cells. #109

Open
SSScholl opened this issue Aug 22, 2024 · 0 comments
Open

Function to update the command for all or individual cells. #109

SSScholl opened this issue Aug 22, 2024 · 0 comments

Comments

@SSScholl
Copy link

SSScholl commented Aug 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant