本文整理汇总了Python中albow.Column.anchor方法的典型用法代码示例。如果您正苦于以下问题:Python Column.anchor方法的具体用法?Python Column.anchor怎么用?Python Column.anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类albow.Column
的用法示例。
在下文中一共展示了Column.anchor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import anchor [as 别名]
def __init__(self, items, keysColumn=None, buttonsColumn=None):
if keysColumn is None:
keysColumn = []
if buttonsColumn is None:
buttonsColumn = []
Widget.__init__(self)
for (hotkey, title, action) in items:
if isinstance(title, (str, unicode)):
button = Button(title, action=action)
else:
button = ValueButton(ref=title, action=action, width=200)
button.anchor = self.anchor
label = Label(hotkey, width=75, margin=button.margin)
label.anchor = "wh"
label.height = button.height
keysColumn.append(label)
buttonsColumn.append(button)
self.buttons = list(buttonsColumn)
buttonsColumn = Column(buttonsColumn)
buttonsColumn.anchor = self.anchor
keysColumn = Column(keysColumn)
commandRow = Row((keysColumn, buttonsColumn))
self.add(commandRow)
self.shrink_wrap()
示例2: __init__
# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import anchor [as 别名]
def __init__(self, items, keysColumn=None, buttonsColumn=None, item_spacing=None):
warn(self)
if keysColumn is None:
keysColumn = []
if buttonsColumn is None:
buttonsColumn = []
labels = []
Widget.__init__(self)
for t in items:
if len(t) == 3:
(hotkey, title, action) = t
tooltipText = None
else:
(hotkey, title, action, tooltipText) = t
if isinstance(title, (str, unicode)):
button = Button(title, action=action)
else:
button = ValueButton(ref=title, action=action, width=200)
button.anchor = self.anchor
label = Label(hotkey, width=100, margin=button.margin)
label.anchor = "wh"
label.height = button.height
labels.append(label)
if tooltipText:
button.tooltipText = tooltipText
keysColumn.append(label)
buttonsColumn.append(button)
self.buttons = list(buttonsColumn)
#.#
if item_spacing == None:
buttonsColumn = Column(buttonsColumn)
else:
buttonsColumn = Column(buttonsColumn, spacing=item_spacing)
#.#
buttonsColumn.anchor = self.anchor
#.#
if item_spacing == None:
keysColumn = Column(keysColumn)
else:
keysColumn = Column(keysColumn, spacing=item_spacing)
commandRow = Row((keysColumn, buttonsColumn))
self.labels = labels
self.add(commandRow)
self.shrink_wrap()
示例3: __init__old
# 需要导入模块: from albow import Column [as 别名]
# 或者: from albow.Column import anchor [as 别名]
def __init__old(self, blockInfo, materials, *a, **kw):
self.root = get_root()
self.allowWildcards = False
Dialog.__init__(self, *a, **kw)
panelWidth = 518
self.click_outside_response = 0
self.materials = materials
self.anySubtype = blockInfo.wildcard
self.matchingBlocks = materials.allBlocks
try:
self.selectedBlockIndex = self.matchingBlocks.index(blockInfo)
except ValueError:
self.selectedBlockIndex = 0
for i, b in enumerate(self.matchingBlocks):
if blockInfo.ID == b.ID and blockInfo.blockData == b.blockData:
self.selectedBlockIndex = i
break
lbl = Label("Search")
# lbl.rect.topleft = (0,0)
fld = TextFieldWrapped(300)
# fld.rect.topleft = (100, 10)
# fld.centery = lbl.centery
# fld.left = lbl.right
fld.change_action = self.textEntered
fld.enter_action = self.ok
fld.escape_action = self.cancel
self.awesomeField = fld
searchRow = Row((lbl, fld))
def formatBlockName(x):
block = self.matchingBlocks[x]
r = "{name}".format(name=block.name)
if block.aka:
r += " [{0}]".format(block.aka)
return r
def formatBlockID(x):
block = self.matchingBlocks[x]
ident = "({id}:{data})".format(id=block.ID, data=block.blockData)
return ident
tableview = TableView(columns=[TableColumn(" ", 24, "l", lambda x: ""),
TableColumn("Name", 415, "l", formatBlockName),
TableColumn("ID", 45, "l", formatBlockID)
])
tableicons = [blockview.BlockView(materials) for i in range(tableview.rows.num_rows())]
for t in tableicons:
t.size = (16, 16)
t.margin = 0
icons = Column(tableicons, spacing=2)
# tableview.margin = 5
tableview.num_rows = lambda: len(self.matchingBlocks)
tableview.row_data = lambda x: (self.matchingBlocks[x], x, x)
tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
tableview.click_row = self.selectTableRow
draw_table_cell = tableview.draw_table_cell
def draw_block_table_cell(surf, i, data, cell_rect, column):
if isinstance(data, Block):
tableicons[i - tableview.rows.scroll].blockInfo = data
else:
draw_table_cell(surf, i, data, cell_rect, column)
tableview.draw_table_cell = draw_block_table_cell
tableview.width = panelWidth
tableview.anchor = "lrbt"
# self.add(tableview)
self.tableview = tableview
tableWidget = Widget()
tableWidget.add(tableview)
tableWidget.shrink_wrap()
def wdraw(*args):
for t in tableicons:
t.blockInfo = materials.Air
tableWidget.draw = wdraw
self.blockButton = blockView = thumbview.BlockThumbView(materials, self.blockInfo)
blockView.centerx = self.centerx
blockView.top = tableview.bottom
# self.add(blockview)
but = Button("OK")
but.action = self.ok
but.top = blockView.bottom
but.centerx = self.centerx
but.align = "c"
#.........这里部分代码省略.........