本文整理汇总了Python中kivy.uix.stacklayout.StackLayout.do_layout方法的典型用法代码示例。如果您正苦于以下问题:Python StackLayout.do_layout方法的具体用法?Python StackLayout.do_layout怎么用?Python StackLayout.do_layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.stacklayout.StackLayout
的用法示例。
在下文中一共展示了StackLayout.do_layout方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stacklayout_nospace
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_nospace(self):
# happens when padding is too big
sl = StackLayout()
wgts = [Widget(size_hint=(1., .25)) for i in range(1, 4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.padding = 10
sl.do_layout()
示例2: test_tb_lr_stacklayout
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_tb_lr_stacklayout(self):
stacklayout = StackLayout(
orientation='tb-lr',
size=(200, 200),
padding=20,
spacing=10)
widget = Widget(width=100, size_hint=(0.2, 0.4))
stacklayout.add_widget(widget)
stacklayout.do_layout()
self.assertEqual(stacklayout.top - widget.top, 20)
示例3: test_stacklayout_spacing
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_spacing(self):
sl = StackLayout()
wgts = [Widget(size_hint=(.5, .5)) for i in range(4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.spacing = 10
sl.do_layout()
self.assertEqual(wgts[0].pos, [0, sl.height / 2.])
self.assertEqual(wgts[1].pos, [sl.width / 2. + 5, sl.height / 2.])
self.assertEqual(wgts[2].pos, [0, -10])
self.assertEqual(wgts[3].pos, [sl.width / 2. + 5, -10])
示例4: test_stacklayout_padding
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_padding(self):
sl = StackLayout()
wgts = [Widget(size_hint=(.5, .5)) for i in range(4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.padding = 5.
sl.do_layout()
self.assertEqual(wgts[0].pos, [5., sl.height / 2.])
self.assertEqual(wgts[1].pos, [sl.width / 2., sl.height / 2.])
self.assertEqual(wgts[2].pos, [5., 5.])
self.assertEqual(wgts[3].pos, [sl.width / 2., 5.])
示例5: test_stacklayout_fixed_size
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_fixed_size(self):
sl = StackLayout()
wgts = [Widget(size=(50, 50), size_hint=(None, None))
for i in range(4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.do_layout()
self.assertEqual(wgts[0].pos, [0, sl.height / 2.])
self.assertEqual(wgts[1].pos, [sl.width / 2., sl.height / 2.])
self.assertEqual(wgts[2].pos, [0, 0])
self.assertEqual(wgts[3].pos, [sl.width / 2., 0])
示例6: test_stacklayout_default
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_default(self):
# Default orientation is lr-tb.
sl = StackLayout()
wgts = [Widget(size_hint=(.5, .5)) for i in range(4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.do_layout()
self.assertEqual(wgts[0].pos, [0, sl.height / 2.])
self.assertEqual(wgts[1].pos, [sl.width / 2., sl.height / 2.])
self.assertEqual(wgts[2].pos, [0, 0])
self.assertEqual(wgts[3].pos, [sl.width / 2., 0])
示例7: test_stacklayout_overflow
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_overflow(self):
sl = StackLayout()
wgts = [Widget(size_hint=(.2 * i, .2 * i)) for i in range(1, 4)]
for wgt in wgts:
sl.add_widget(wgt)
sl.padding = 5
sl.spacing = 5
sl.do_layout()
self.assertEqual(wgts[0].pos, [5, 77])
self.assertEqual(wgts[1].pos, [27, 59])
# floating point error, requires almost equal
self.assertAlmostEqual(wgts[2].pos[0], 5)
self.assertAlmostEqual(wgts[2].pos[1], 0)
示例8: test_stacklayout_no_children
# 需要导入模块: from kivy.uix.stacklayout import StackLayout [as 别名]
# 或者: from kivy.uix.stacklayout.StackLayout import do_layout [as 别名]
def test_stacklayout_no_children(self):
sl = StackLayout()
sl.do_layout()