本文整理汇总了Python中vecrec.Rect.null方法的典型用法代码示例。如果您正苦于以下问题:Python Rect.null方法的具体用法?Python Rect.null怎么用?Python Rect.null使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vecrec.Rect
的用法示例。
在下文中一共展示了Rect.null方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parent_changed
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def test_parent_changed():
child, parent = Rect.null(), Rect.null()
def change_parent(child_rect, parent_rect):
parent_rect.left += 1
with pytest.raises(RuntimeError, match='change_parent'):
glooey.drawing.align(change_parent, child, parent)
示例2: test_not_enough_cols
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def test_not_enough_cols():
with pytest.raises(UsageError):
drawing.make_grid(
Rect.null(),
cells={
(0,1): Rect.null(),
},
num_rows=1,
num_cols=1,
)
示例3: __init__
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def __init__(self, rect=None, color='green', *,
batch=None, group=None, usage='static', hidden=False):
self._rect = rect or Rect.null()
self._color = Color.from_anything(color)
data = 'v2f/' + usage, 'c4B/' + usage
super().__init__(batch, group, 4, GL_QUADS, data, hidden)
示例4: __init__
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def __init__(self, *, bounding_rect=None, min_cell_rects=None,
num_rows=0, num_cols=0, padding=None, inner_padding=None,
outer_padding=None, row_heights=None, col_widths=None,
default_row_height='expand', default_col_width='expand'):
# Attributes that the user can set to affect the shape of the grid.
self._bounding_rect = bounding_rect or Rect.null()
self._min_cell_rects = min_cell_rects or {}
self._requested_num_rows = num_rows
self._requested_num_cols = num_cols
self._inner_padding = first_not_none((inner_padding, padding, 0))
self._outer_padding = first_not_none((outer_padding, padding, 0))
self._requested_row_heights = row_heights or {}
self._requested_col_widths = col_widths or {}
self._default_row_height = default_row_height
self._default_col_width = default_col_width
# Read-only attributes that reflect the current state of the grid.
self._num_rows = 0
self._num_cols = 0
self._max_cell_heights = {}
self._max_cell_widths = {}
self._fixed_rows = set()
self._expandable_rows = set()
self._fixed_cols = set()
self._expandable_cols = set()
self._fixed_row_heights = {}
self._fixed_col_widths = {}
self._min_expandable_row_heights = {}
self._min_expandable_col_widths = {}
self._padding_height = 0
self._padding_width = 0
self._min_height = 0
self._min_width = 0
self._row_heights = {}
self._col_widths = {}
self._width = 0
self._height = 0
self._row_tops = {}
self._col_lefts = {}
self._cell_rects = {}
# Attributes that manage the cache.
self._is_shape_stale = True
self._is_claim_stale = True
self._are_cells_stale = True
示例5: test_infer_grid_size
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def test_infer_grid_size():
cells = drawing.make_grid(
Rect.from_size(10, 10),
cells={
(0,0): Rect.null(),
},
)
assert cells == {
(0,0): Rect(0, 0, 10, 10),
}
cells = drawing.make_grid(
Rect.from_size(10, 10),
cells={
(0,0): Rect.null(),
(1,0): Rect.null(),
},
)
assert cells == {
(0,0): Rect(0, 5, 10, 5),
(1,0): Rect(0, 0, 10, 5),
}
cells = drawing.make_grid(
Rect.from_size(10, 10),
cells={
(0,0): Rect.null(),
(0,1): Rect.null(),
},
)
assert cells == {
(0,0): Rect(0, 0, 5, 10),
(0,1): Rect(5, 0, 5, 10),
}
cells = drawing.make_grid(
Rect.from_size(10, 10),
cells={
(0,0): Rect.null(),
(1,1): Rect.null(),
},
)
assert cells == {
(0,0): Rect(0, 5, 5, 5),
(0,1): Rect(5, 5, 5, 5),
(1,0): Rect(0, 0, 5, 5),
(1,1): Rect(5, 0, 5, 5),
}
示例6: test_no_cells
# 需要导入模块: from vecrec import Rect [as 别名]
# 或者: from vecrec.Rect import null [as 别名]
def test_no_cells():
cells = drawing.make_grid(
Rect.null()
)
assert cells == {}