Skip to content Skip to sidebar Skip to footer

App.get_running_app().root.my_method() - 'nonetype' Object Has No Attribute 'my_method()

I try to call a function on my Screenmanager after a button was pressed. But the call to (App.get_running_app().root.) does not get me an object. The Buttons will not work for me

Solution 1:

Try to schedule it with clock, so you are sure the app and widgets are ready

from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.app import App
from kivy.clock import Clock

class DashboardScreen(Screen):

    def __init__(self, **kwargs):
        super(DashboardScreen, self).__init__(**kwargs)
        Clock.schedule_once(self.after_init)

    def after_init(self, dt):
        App.get_running_app().root.get_character_selection_screen()

Post a Comment for "App.get_running_app().root.my_method() - 'nonetype' Object Has No Attribute 'my_method()"