Skip to content

Add column hidden function #123

@notready123

Description

@notready123

Hello Akascape,

Would you like to add thoses function to your class ? I added it manually to mine but I think it could be usefull for users :

def init(...;
self.hidden_columns = set()

def set_column_hidden(self, column_index, hidden=True):
    """Masquer ou afficher une colonne."""
    if hidden:
        self.hidden_columns.add(column_index)
    else:
        self.hidden_columns.discard(column_index)
    self.update_table_display()
    
def update_table_display(self):
    for row in range(self.rows):
        shift = 0 
        for column in range(self.columns):
            cell_widget = self.frame[row, column]
            if column in self.hidden_columns:
                cell_widget.grid_forget()
                shift += 1 
            else:
                cell_widget.grid(row=row, column=column-shift)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions