是否可以隐藏Grid中的特定列?

时间:2015-08-17 08:59:11

标签: python wxpython

我在wx.Grid中使用wxpython ... 我有一个包含许多列的常规网格 - 使用SetColumn(self, column)创建,我希望能够根据用户安全权限显示和隐藏特定列。

我读到self.SetColMinimalAcceptableWidth(0)可能有用吗?如何在特定列上使用它?如何在需要显示时将列恢复为原始大小?

1 个答案:

答案 0 :(得分:1)

网格手册有以下条目:

HideCol(self,col)

count = 0
increment = 5
total_employees = 5
run_salary = 0
emp_bucket = []
for items in List1:
    count += 1
    if count <= total_employees:
        run_salary += items[1]
    else:
        emp_bucket.append(run_salary)
        total_employees += increment
        count = 0
        run_salary = 0

所以在self.Mygrid的情况下:

Hides the specified column.

To show the column later you need to call SetColSize with non-0 width or ShowCol to restore the previous column width.

If the column is already hidden, this method doesn’t do anything.
Parameters: col (int) – The column index.    

会隐藏第一列。