Iorzua Emmanuel
Iorzua Emmanuel

Reputation: 9

Blank screen in screen manager kivy

please help me check out this code. Each time I run it, it displays a blank screen, am a newbie to kivy.

from kivy.app import App
from kivy.uix.widget import Widget 
from kivy.uix.button import Button
from kivy.uix.screenmanager import           ScreenManager,Screen 
from kivy.lang import Builder 


class first_screen(Screen):
    pass

class second_screen(Screen):
    pass 

class my_manager(ScreenManager):
    pass 


Builder.load_file("testing_screens.kv")

class testing_screens(App):
    def build(self):
        return my_manager()



testing_screens().run()


<my_manager>:
    first_screen:
    second_screen:

<first_screen>:
    name: "one"
    Button:
        text: "hello peeps"
        on_press: app.root.current= "two"

<second_screen>:
    name: "two"
    Button:
        text: "world gurus"
        on_press: app.root.current= "one"

The code is messed up.

Upvotes: 0

Views: 1913

Answers (1)

inclement
inclement

Reputation: 29498

Widget names must begin with capital letters for kv to work, as it uses this to distinguish them from properties. In this case the kv rule thinks you made two new properties named first_screen and second_screen, not that you added two widgets.

Upvotes: 1

Related Questions