DEV Community

An-Nautiyal
An-Nautiyal

Posted on

help me !!

Trying to develop an android application using python and kivymd..
can anyone help me solve the error in the following code file
code --
from kivy.animation import Animation
from kivy.clock import Clock
from kivymd.app import MDApp
from kivy.uix.image import Image
from kivymd.uix.screenmanager import ScreenManager
from kivy.uix.screenmanager import Screen

... (Other imports and classes)

class SplashScreen(Screen):

def on_enter(self):
    self.animate_logo()
    Clock.schedule_once(self.transition_to_main_screen, 3)  # Adjust transition time as needed

def animate_logo(self):
    logo_image = self.logo_image
    if logo_image:
        anim = Animation(size_hint_x=1.2, duration=0.5)
        anim.bind(on_complete=self.animate_logo_back)
        anim.start(logo_image)

def animate_logo_back(self, *args):
    logo_image = self.logo_image
    if logo_image:
        anim = Animation(size_hint_x=1, duration=0.5)
        anim.start(logo_image)

def transition_to_main_screen(self, dt):
    self.manager.current = 'main_screen'  # Replace 'main_screen' with your main screen name
Enter fullscreen mode Exit fullscreen mode

... (Other imports and classes)

class MainScreen(Screen):
# ... (Other screen logic)

def login(self):
    # Implement your login logic here
    username = self.ids.username_field.text
    password = self.ids.password_field.text
    # ... (Check credentials, navigate to appropriate screen)

def show_signup_screen(self):
    self.manager.current = 'signup_screen'  # Replace with your signup screen name
Enter fullscreen mode Exit fullscreen mode

... (Rest of your MainApp and other classes)

class MainApp(MDApp):
# ... (Other app logic)

def build(self):
    sm = ScreenManager()
    sm.add_widget(SplashScreen(name='splash_screen'))
    sm.add_widget(MainScreen(name='main_screen'))  # Add your main screen
    sm.current = 'splash_screen'
    return sm
Enter fullscreen mode Exit fullscreen mode

if name == 'main':
MainApp().run() # Ensure app runs only when executed as a script

Top comments (0)