Python kivy.uix.relativelayout.RelativeLayout() Examples

The following are 5 code examples of kivy.uix.relativelayout.RelativeLayout(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module kivy.uix.relativelayout , or try the search function .
Example #1
Source File: slidingpanel.py    From KivyMD with MIT License 6 votes vote down vote up
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 
Example #2
Source File: carousel.py    From Tickeys-linux with MIT License 5 votes vote down vote up
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) 
Example #3
Source File: carousel.py    From Tickeys-linux with MIT License 5 votes vote down vote up
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) 
Example #4
Source File: carousel.py    From Tickeys-linux with MIT License 5 votes vote down vote up
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) 
Example #5
Source File: carousel.py    From Tickeys-linux with MIT License 5 votes vote down vote up
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)