ScreenManagerException: ScreenManager accepts only Screen widget

Viewed 20

I am trying to add my settings screen just like my other screens to the screen manager but when I add the settings screen the code won't work. All of my other screens are working whenever I comment this screen out but this screen doesn't work in the screen manager.

Here is my .kv file:

WindowManager:
    id: sm
    transition: WipeTransition()
    Settings:
    Threewaygame:
    Main:
    Special:
    Tournament:
    Game:
    Normal:
    Login:

<Settings>:
    name: "Settings_Mode_Window"
    canvas:
        Color:
            rgba: 0.2, 0.4, 0.6, 1
        Rectangle:
            size: self.size
            pos: self.pos
    
    GridLayout:
        id: settings_top_invisible_grid_layout
        size_hint: 0.05, 1
        orientation: "lr-tb"
        rows: 1
        cols: 1

    GridLayout:
        id: settings_top
        size_hint: 0.2, 1
        orientation: "lr-tb"
        rows: 1
        cols: 3
        
        Label:
            id: invisible_label_settings_top_0
            size_hint: 0.2, 1
        
        Button:
            id: go_back_settings
            background_color: (0,0,0,0)
            background_normal: ''
            color: 0, 0, 0, 1
            size_hint: 1, 1
            on_release: root.go_back()
            canvas.before:
                Color:
                    rgba: (0, 0, 0, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [10, 10, 10, 10]  
        
        Label:
            id: invisible_label_settings_top_1
            size_hint: 5.5, 1
        

    GridLayout:
        id: settings_main
        size_hint: 1, 1
        orientation: "tb-lr"
        rows: 6
        cols: 1
        spacing: 20
        padding: ("0dp", "20dp", "0dp", "20dp")
        
        Button:
            id: login_google_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Login with Google"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
            
        Button:
            id: login__settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Login with Google"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
        
        Button:
            id: audio_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Login with Google"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
        
        Button:
            id: vibration_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Vibration"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
        
        Button: 
            id: allow_add_as_friend_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Allow Add As Friend"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
        
        Button: 
            id: allow_challenges_from_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Allow Challenges From"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]

        Button:
            id: terms_and_conditions_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Terms and Conditions"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
        
        Button:
            id: privacy_policy_settings
            background_color: (0,0,0,0)
            background_normal: ''
            text: "Privacy Policy"
            #font_name: "../fonts/Beyond-1.5.otf"
            #font_size: self.width/3.6
            color: 0, 0, 0, 1
            canvas.before:
                Color:
                    rgba: (1, 1, 1, 1)
                RoundedRectangle:
                    size: self.size
                    pos: self.pos
                    radius: [6]
    
    Label:
        id: settings_bottom_invisible_grid_layout
        size_hint: 0.12, 1 

Here is my .py file:

class Settings(Screen):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def go_back(self):
        self.set_previous_screen()

    def set_previous_screen(self):
        if self.parent.current == "Settings_Mode_Window":
            self.parent.transition.direction = "left"
            self.parent.current = "Main_Window"

I am not able to find any errors in the code, your help would be appreciated.

0 Answers
Related