Hello,
I did pick up the topic again.
Atlas is not the best solution for me, as I want to have a customer skinnable object.
When I look at the kv language for the slider and the sources, there are 3 elements in the canvas:
- Color
- Rectangle
- BorderImage
So my idea was, to clear the canvas and to add the elements manually with my images. This works, but I can't move the slider button anymore. To be honest, I could not find any parts in the kivy code, which shows me the "connection" of the touch to the move of the slider button.
Original KV Language Code looks like that:
Color:
rgb: 1, 1, 1
BorderImage:
border: (0, 18, 0, 18) if self.orientation == 'horizontal' else (18, 0, 18, 0)
pos: (self.x, self.center_y - 18) if self.orientation == 'horizontal' else (self.center_x - 18, self.y)
size: (self.width, 37) if self.orientation == 'horizontal' else (37, self.height)
source: 'atlas://data/images/defaulttheme/slider%s_background' % self.orientation[0]
Rectangle:
pos: (self.value_pos[0] - 16, self.center_y - 17) if self.orientation == 'horizontal' else (self.center_x - 16, self.value_pos[1] - 16)
size: (32, 32)
source: 'atlas://data/images/defaulttheme/slider_cursor'
My code loks as follows:
from kivy.uix.slider import Slider
oSlider=Slider(min=-100, max=100, value=25,posx=100,posy=100)
from kivy.graphics import Color
from kivy.graphics import Rectangle
from kivy.graphics import BorderImage
oSlider.canvas.clear()
oSlider.canvas.add(Color(1., 1., 1.))
oSlider.canvas.add(BorderImage(border=(0, 18, 0, 18), pos= (oSlider.x, oSlider.center_y - 18) ,size= (oSlider.width, 37), source='MYBACKGROUND.png'))
oSlider.canvas.add(Rectangle( pos= (oSlider.value_pos[0] - 16, oSlider.center_y - 17), size= (32, 32),source='MYKNOB.png'))
BackGround.add_widget(oSlider)