Closed recordit closed 3 years ago
@HeaTTheatR Is the second part of my report also bug?
@alexcode4u No.
The problem is this:
If the GridLayout's
height is set to minimum_height
, then the shakes effect cannot be avoided if all the elements fit on the screen and cannot be scrolled:
Shakes effect
from kivy.animation import Animation
from kivy.lang import Builder
from kivy.app import App
KV = '''
ScrollView:
GridLayout:
id: box
cols: 1
size_hint_y: None
height: self.minimum_height
Button:
text: "TEXT"
size_hint_y: None
height: 100
on_press: app.anim()
Button:
id: button
text: "TEXT"
size_hint_y: None
height: 100
'''
class Test(App):
def build(self):
self.flag = 0
return Builder.load_string(KV)
def anim(self):
if not self.flag:
self.flag = True
Animation(height=200, d=0.2).start(self.root.ids.button)
else:
self.flag = False
Animation(height=100, d=0.2).start(self.root.ids.button)
Test().run()
The automatic calculation of the GridLayout's height results in the shakes effect. This effect can be avoided if you know for sure that there will be one or two elements in the GridLayout, and they all fit on the screen. In this case, you shouldn't use the minimum_height for the GridLayout. There is no shakes effect if the GridLayout is set to minimum_height and items can be scrolled.
Without shakes effect
from kivy.animation import Animation
from kivy.lang import Builder
from kivy.app import App
KV = '''
ScrollView:
GridLayout:
id: box
cols: 1
Button:
text: "TEXT"
size_hint_y: None
height: 100
on_press: app.anim()
Button:
id: button
text: "TEXT"
size_hint_y: None
height: 100
'''
class Test(App):
def build(self):
self.flag = 0
return Builder.load_string(KV)
def anim(self):
if not self.flag:
self.flag = True
Animation(height=200, d=0.2).start(self.root.ids.button)
else:
self.flag = False
Animation(height=100, d=0.2).start(self.root.ids.button)
Test().run()
The analysis of the problem has been completed, the reasons have been identified, so I believe that the problem can be closed.
Description of the Bug
1) When i close and open panel, it shakes. And other part of screen that located in panel's container(for our example, that's Scrollview) also shakes. Video: https://yadi.sk/i/gIZp_sk4CnG7hw Code:
2) When panel is open and i add any item to the panel, panel's container(for our example that's ScrollView) "jumps" to the bottom. Video: https://yadi.sk/i/Eksswx426d_AOQ
Versions