Black screen when running a simple interface made in Kivy - Python

Asked

Viewed 232 times

0

I’m learning about using multiple screens in the kivy (using Screenmanager). However, when I run the code below I come across a black screen. No error occurs, but I could not find out which error.

Code Testapp.py:

import kivy
from kivy.app import App
from kivy.uix.screenmanager import Screen
from kivy.uix.screenmanager import ScreenManager

class Tela(ScreenManager):
    pass

class Screen1(Screen):
    pass

class Screen2(Screen):
    pass

class Test(App):
    def build(self):
        return Tela()

Test().run()

Code Test.K V

<Tela>:
    Screen1:
        name:'screen1'
        id:screen1

    Screen2:
        name:'screen2'
        id:screen2

<Screen1>:
    BoxLayout:
        orientation: 'vertical'
        Button:
            text:'ME APERTA'
            on_release: root.manager.current = 'screen2'

<Screen2>:
    BoxLayout:
        orientation: 'vertical'
        Button:
            text:'ME APERTA DE NOVO'
            on_release: root.manager.current = 'screen1'

Run screen + terminal:

Tela de execução + Terminal

If the community can help me, my future thanks :D:

  • 2

    You need to rename the Kv file to test.kv lower-case.

  • Thank you very much friend, :D

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.