Hi,
The app I am developing has a horizontal button bar (FloatLayout) along the top of the window.
Beneath that is a BoxLayout containing a Scatter, which contains an Image.
I want to be able to scale the image without the image covering the buttons.
For this to happen, either:
- the image must either be behind the button bar (i.e., deeper into the window)
or ideally,
- when the Scatter is scaled, its contents should not be displayed past the bounds of the BoxLayout
Here are two screenshots of the app:
Before scaling the image, image does not cover buttons:
After scaling the Scatter using its scale() method:
As you can see, the image covers the buttons when it is scaled.
Here is a snippet of .kv:
FloatLayout:
# Button bar
# Buttons etc.
BoxLayout:
...
Scatter:
BoxLayout:
size: self.parent.size
id: image_container
orientation: 'vertical'
pos: 0, 0
Image:
id:disc_image
size_hint: 1,1
pos: 0, 0
allow_stretch: True
keep_ratio: True
opacity: 0
source: None
Since I am adding the Scatter in kv language, I cannot set the depth with add_widget()'s index parameter as I would be able to in python code.
However, if I was to use the index parameter, I believe the BoxLayout that the button bar and Scatter are nested under would
change their order as well as their depth, which is even less desirable.
It would seem that this is a fundamental problem in Kivy; it is necessary to be able to set widget depth and BoxLayout's order independently of each other.
Is there a way to set only the depth of widgets in the kv language?