Hi everybody, I have designed a splash screen that will display the logo of the app and after 3 seconds it will be transferred to the login page. The splash and login screens are designed in two separate .kv files. The problem I have encountered is that I have a Repeating loop and screens are displayed synchronous after 3 sec.
What I have tried:
main.py file
class SplashScreen(MDScreen):
def on_enter(self, *args):
Clock.schedule_once(self.switch_to_home, 3)
def switch_to_home(self, dt):
LoginApp().run()
class LoginApp(MDApp):
def build(self):
self.manager = ScreenManager()
self.manager.add_widget(Login(name='login'))
return self.manager
class StartPage(MDApp):
def build(self):
return Builder.load_file('logo.kv')
if __name__ == '__main__':
StartPage().run()
logo.kv file
ScreenManager:
orientation:'vertical'
SplashScreen:
name: 'Splash'
Image:
source:'logo.png'
pos_hint:{'center_x':0.5,'center_y':.6}
MDLabel:
text: "LEITNER"
halign:'center'
pos_hint:{'center_x':0.5,'center_y':.3}
login.kv
<Login>:
name:'login'
Image:
source:'logo.png'
pos_hint:{'center_x':0.5,'center_y':.9}
MDTextFieldRound:
id: user
hint_text: "username"
icon_right: "account"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5,'center_y':.7}
MDTextFieldRound:
id: password
hint_text: "password"
icon_right: "eye-off"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5,'center_y':.6}
password: True
MDRoundFlatButton:
text: "LOG IN"
font_size: 12
pos_hint: {"center_x": 0.5,'center_y':.4}
on_press: root.connect()
login.py file
from kivy.uix.screenmanager import Screen, SlideTransition
from kivymd.toast import toast
class Login(Screen):
pass
def connect(self):
toast('Login and Password are correct!')