本文整理汇总了Python中chaco.api.VPlotContainer.do_layout方法的典型用法代码示例。如果您正苦于以下问题:Python VPlotContainer.do_layout方法的具体用法?Python VPlotContainer.do_layout怎么用?Python VPlotContainer.do_layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chaco.api.VPlotContainer
的用法示例。
在下文中一共展示了VPlotContainer.do_layout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_halign
# 需要导入模块: from chaco.api import VPlotContainer [as 别名]
# 或者: from chaco.api.VPlotContainer import do_layout [as 别名]
def test_halign(self):
container = VPlotContainer(bounds=[200,300], halign="center")
comp1 = StaticPlotComponent([100,200])
container.add(comp1)
container.do_layout()
self.assertEqual(comp1.position, [50,0])
container.halign="right"
container.do_layout(force=True)
self.assertEqual(comp1.position, [100,0])
return
示例2: test_stack_nonresize
# 需要导入模块: from chaco.api import VPlotContainer [as 别名]
# 或者: from chaco.api.VPlotContainer import do_layout [as 别名]
def test_stack_nonresize(self):
container = VPlotContainer(bounds=[100,300])
comp1 = StaticPlotComponent([70,100])
comp2 = StaticPlotComponent([80,90])
comp3 = StaticPlotComponent([90,80])
container.add(comp1, comp2, comp3)
container.do_layout()
self.assert_tuple(container.get_preferred_size(), (90, 270))
self.assert_tuple(container.bounds, (100,300))
self.assert_tuple(comp1.position, (0,0))
self.assert_tuple(comp2.position, (0,100))
self.assert_tuple(comp3.position, (0,190))
return
示例3: test_stack_one_resize
# 需要导入模块: from chaco.api import VPlotContainer [as 别名]
# 或者: from chaco.api.VPlotContainer import do_layout [as 别名]
def test_stack_one_resize(self):
"Checks stacking with 1 resizable component thrown in"
container = VPlotContainer(bounds=[100,300])
comp1 = StaticPlotComponent([70,100])
comp2 = StaticPlotComponent([80,90])
comp3 = StaticPlotComponent([90,80], resizable='hv')
comp4 = StaticPlotComponent([50,40])
container.add(comp1, comp2, comp3, comp4)
container.do_layout()
self.assert_tuple(container.get_preferred_size(), (80,230))
self.assert_tuple(container.bounds, (100,300))
self.assert_tuple(comp1.position, (0,0))
self.assert_tuple(comp2.position, (0,100))
self.assert_tuple(comp3.position, (0,190))
self.assert_tuple(comp4.position, (0,260))
return
示例4: test_fit_components
# 需要导入模块: from chaco.api import VPlotContainer [as 别名]
# 或者: from chaco.api.VPlotContainer import do_layout [as 别名]
def test_fit_components(self):
container = VPlotContainer(bounds=[200,300], resizable="v", fit_components="v")
comp1 = StaticPlotComponent([50,100], padding=5)
comp2 = StaticPlotComponent([50,120], padding=5)
container.add(comp1)
container.add(comp2)
self.assert_tuple(container.get_preferred_size(), (200,240))
# The container should not change its size as a result of its fit_components
# being set.
self.assert_tuple(container.bounds, (200,300))
container.bounds = container.get_preferred_size()
container.do_layout()
container.padding = 8
self.assert_tuple(container.get_preferred_size(), (216,256))
container.do_layout()
self.assert_tuple(comp1.outer_position, (0,0))
self.assert_tuple(comp2.outer_position, (0,110))