本文整理汇总了Python中pyjamas.ui.HTML.HTML.position方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.position方法的具体用法?Python HTML.position怎么用?Python HTML.position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HTML.HTML
的用法示例。
在下文中一共展示了HTML.position方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas.ui.HTML import HTML [as 别名]
# 或者: from pyjamas.ui.HTML.HTML import position [as 别名]
def __init__(self, grid_size):
Grid.__init__(self)
# populate the grid with some stuff
#
self.resize(grid_size, grid_size)
self.setBorderWidth(2)
self.setCellPadding(4)
self.setCellSpacing(1)
self.setStyleName("gameboard") # just doesn't work
# Set up game board
#
# Note that must iterate over indices, rather than Cell
# instances, until the table positions are set up here
#
index = 0 # debug
for i in range(grid_size):
for j in range(grid_size):
cell = HTML(SPACE)
# cell.setVisible(False) # causes to ignore click events
cell.position = (i, j) # might be handy at some point
index+=1; cell.index = index # debug
# cell.setStyleName("cell_O")
cell.addClickListener(getattr(self, "onCellClicked"))
self.setWidget(i, j, cell)