Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.uix.screenmanager import Screen, ScreenManager, NoTransition
- from kivymd.app import MDApp
- from kivy.clock import Clock
- import os
- BASE_PATH = os.path.abspath('./utils/design_files/')
- class SplashScreen(Screen):
- def __init__(self, **kw):
- self._splash_kv_file = Builder.load_file(filename=f"{BASE_PATH}/splash_screen_design.kv")
- super().__init__(**kw)
- self.tip_labels = ["Tip 1: Your tip text here.",
- "Tip 2: Another tip text.",
- "Tip 3: More tips...",
- "Tip 4: Customize your tips."]
- self.show_random_tip()
- def show_random_tip(self):
- self.ids.tip_label.text = choice(self.tip_labels)
- class MyApp(MDApp):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- self.screen = None
- def build(self):
- self.title = "My-App"
- # Create a ScreenManager with no transition
- screen_manager = ScreenManager(transition=NoTransition())
- splash_screen = SplashScreen(name='splash')
- screen_manager.add_widget(splash_screen)
- Clock.schedule_once(self.switch_to_main_screen, 5)
- return screen_manager
- def switch_to_main_screen(self, _):
- pass
Advertisement
Add Comment
Please, Sign In to add comment