KivyMD
KivyMD copied to clipboard
Problems with the use of 'MDSpinner'.
I just want to use MDSpinner to do a loading animation beautification. Then load the MDList.
Like the code below, I create two 'MDBottomNavigationItem' widgets, 'TEXT' are 'a' and 'b' respectively, what I want to achieve is, when 'A' is triggered, execute 'MDSpinner' to load Animation, "Display the "MDList" text after the animation is completed, the current code logic is that two widgets are displayed at the same time, in no particular order.
still have a question. After the 'MDSpinner' in the A button is loaded, click the A event again (or click the B button to return to the A button), and the 'MDSpinner' loading animation will no longer be displayed unless the program is re-run.
thank you very much.
from kivy.lang import Builder
from kivymd.app import MDApp
class Test(MDApp):
def build(self):
return Builder.load_string(
'''
MDBottomNavigation:
MDBottomNavigationItem:
name:'shield-home1'
text:'A'
icon:'home'
MDSpinner:
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
determinate: True
ScrollView:
pos_hint:{'x':.0,'y':.001}
size_hint_y:.94
MDList:
TwoLineListItem:
on_size: self.ids._text_container.spacing = "4dp" # 文本间隔
text:'aaaaaaa'
secondary_text: 'bbbbbbbbb'
MDBottomNavigationItem:
name:'shield-home2'
text:'B'
icon:'home-analytics'
'''
)
Test().run()
@HeaTTheatR
You marked this as a bug, so is this a bug in KIVYMD?
Need your version update solution?
@471657 I will try to fix it soon. For now, you can use the MDSpinner
without the determined
parameter
@HeaTTheatR Thank you very much! I'll try it first!
@HeaTTheatR
Hi, I removed the "determinate" parameter. Its current state appears to be an animation that reloads forever.
Currently "MDList" is initialized and loaded at startup, instead of waiting for "MDSpinner" to finish loading and then displaying "MDList" before loading
from kivy.lang import Builder
from kivymd.app import MDApp
class Test(MDApp):
def build(self):
return Builder.load_string(
'''
MDBottomNavigation:
MDBottomNavigationItem:
name:'shield-home1'
text:'A'
icon:'home'
MDSpinner:
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
ScrollView:
pos_hint:{'x':.0,'y':.001}
size_hint_y:.94
MDList:
TwoLineListItem:
on_size: self.ids._text_container.spacing = "4dp" # 文本间隔
text:'aaaaaaa'
secondary_text: 'bbbbbbbbb'
MDBottomNavigationItem:
name:'shield-home2'
text:'B'
icon:'home-analytics'
'''
)
Test().run()
The issue is deprecated due to the new API of the KivyMD library 2.0.0 version