本文整理匯總了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)