KivyMD icon indicating copy to clipboard operation
KivyMD copied to clipboard

Problems with the use of 'MDSpinner'.

Open ChinaGodzilla opened this issue 1 year ago • 4 comments

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()

ChinaGodzilla avatar Jul 19 '22 13:07 ChinaGodzilla

@HeaTTheatR

You marked this as a bug, so is this a bug in KIVYMD?

Need your version update solution?

ChinaGodzilla avatar Jul 20 '22 12:07 ChinaGodzilla

@471657 I will try to fix it soon. For now, you can use the MDSpinner without the determined parameter

HeaTTheatR avatar Jul 20 '22 13:07 HeaTTheatR

@HeaTTheatR Thank you very much! I'll try it first!

ChinaGodzilla avatar Jul 20 '22 13:07 ChinaGodzilla

@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()

ChinaGodzilla avatar Jul 20 '22 14:07 ChinaGodzilla

The issue is deprecated due to the new API of the KivyMD library 2.0.0 version

HeaTTheatR avatar Jan 10 '24 09:01 HeaTTheatR