本文整理汇总了Python中kivy.uix.relativelayout.RelativeLayout方法的典型用法代码示例。如果您正苦于以下问题:Python relativelayout.RelativeLayout方法的具体用法?Python relativelayout.RelativeLayout怎么用?Python relativelayout.RelativeLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.relativelayout
的用法示例。
在下文中一共展示了relativelayout.RelativeLayout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_parent
# 需要导入模块: from kivy.uix import relativelayout [as 别名]
# 或者: from kivy.uix.relativelayout import RelativeLayout [as 别名]
def on_parent(self, instance, value):
if value is None:
pass
elif issubclass(value.__class__, RelativeLayout) or value == Window:
self.y = 0
if self.side == 'left':
self.x = -self.nav_width
else:
self.x = value.width
else:
self.y = value.y
if self.side == 'left':
self.x = value.x - self.nav_width
else:
self.x = value.x + value.width
self._initial_x = self.x
示例2: add_widget
# 需要导入模块: from kivy.uix import relativelayout [as 别名]
# 或者: from kivy.uix.relativelayout import RelativeLayout [as 别名]
def add_widget(self, widget, index=0):
slide = RelativeLayout(size=self.size, x=self.x - self.width, y=self.y)
slide.add_widget(widget)
super(Carousel, self).add_widget(slide, index)
if index != 0:
self.slides.insert(index, widget)
else:
self.slides.append(widget)
示例3: remove_widget
# 需要导入模块: from kivy.uix import relativelayout [as 别名]
# 或者: from kivy.uix.relativelayout import RelativeLayout [as 别名]
def remove_widget(self, widget, *args, **kwargs):
# XXX be careful, the widget.parent refer to the RelativeLayout
# added in add_widget(). But it will break if RelativeLayout
# implementation change.
# if we passed the real widget
if widget in self.slides:
slide = widget.parent
self.slides.remove(widget)
return slide.remove_widget(widget, *args, **kwargs)
return super(Carousel, self).remove_widget(widget, *args, **kwargs)