本文整理汇总了Python中Grid.Grid.setColLabelValue方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.setColLabelValue方法的具体用法?Python Grid.setColLabelValue怎么用?Python Grid.setColLabelValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid.Grid
的用法示例。
在下文中一共展示了Grid.setColLabelValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UserList
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import setColLabelValue [as 别名]
class UserList(AbsolutePanel):
userGrid = None
newBtn = None
deleteBtn = None
users = None
selectedUser = None
def __init__(self,parent):
AbsolutePanel.__init__(self)
self.userGrid = Grid()
self.userGrid.createGrid(6, 6)
self.userGrid.addTableListener(self)
self.userGrid.setBorderWidth(2)
self.userGrid.setCellPadding(4)
self.userGrid.setCellSpacing(1)
self.userGrid.setColLabelValue(0,"Username")
self.userGrid.setColLabelValue(1,"First Name")
self.userGrid.setColLabelValue(2,"Last Name")
self.userGrid.setColLabelValue(3,"Email")
self.userGrid.setColLabelValue(4,"Department")
self.userGrid.setColLabelValue(5,"Password")
self.newBtn = Button("New")
self.deleteBtn = Button("Delete")
self.deleteBtn.setEnabled(False)
self.add(self.userGrid)
self.add(self.newBtn)
self.add(self.deleteBtn)
return
def updateUserGrid(self, users):
self.userGrid.clearGrid()
self.users = users
for i in range(len(users)):
self.userGrid.setCellValue(i, 0, users[i].username)
self.userGrid.setCellValue(i, 1, users[i].fname)
self.userGrid.setCellValue(i, 2, users[i].lname)
self.userGrid.setCellValue(i, 3, users[i].email)
self.userGrid.setCellValue(i, 4, users[i].department)
self.userGrid.setCellValue(i, 5, users[i].password)
def onCellClicked(self, sender, row, col):
try:
if row > 0 and row <= len(self.users):
self.selectedUser = self.users[row-1]
self.userGrid.selectRow(row)
self.deleteBtn.setEnabled(True)
else:
self.userGrid.selectRow(-1)
self.selectedUser = None
self.deleteBtn.setEnabled(False)
except IndexError:
pass
def deSelect(self):
self.userGrid.selectRow(-1)