I need to open popup window when I check the Login Password. I will put the Login Password code in the place of time code after that. But even with time code, I can't open the animated Gif and after 10s the window is closed automatically. This is my code
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.popup import Popup
from kivy.uix.gridlayout import GridLayout
import time
kv = """
<Test@AnchorLayout>:
AsyncImage:
source: 'wait.gif'
anim_delay: 0.1
Test:"""
class TestApp(App):
def build(self):
layout = GridLayout(cols=1, padding=10)
anim = Builder.load_string(kv)
layout.add_widget(anim)
popup = Popup(content=layout)
popup.open()
print('Hello world')
now = time.time()
future = now + 10
while time.time() < future:
popup.dismiss()
if __name__ == '__main__':
TestApp().run()
here is another answer which works perfectly:
from kivy.clock import Clock
#rest of the code above
def build(self):
layout = GridLayout(cols=1, padding=10)
anim = Builder.load_string(kv)
layout.add_widget(anim)
popup = Popup(content=layout)
popup.open()
print('Hello world')
Clock.schedule_once(App().get_running_app().stop,10)#....rest of the code below
u can use the clock feature. idk why i forgot it lol ;D