I'm using Linux OS, Python 2 and the last version of Kivy framework.
Here i have 2 files that i have typed them exactly as what i watched on a kivy tutorial video.
Fist file is "main.py":

from kivy.app import App

from kivy.uix.scatter import Scatter
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout

class ScatterTextWidget(BoxLayout):

class TutorialApp(App):
    def build(self):
        return ScatterTextWidget()

if __name__ == "__main__":

And the second one is "Tutorial.kv":

    orientation: "vertical"
        id: my_textinput
        font_size: 120
        size_hint_y: None;
        height: 200
        text: "Hello World!"
                text: my_textinput.text
                font_size: 120

Both files are on my desktop. When i run "python main.py" a black empty window appears only. Why the kivy file can't be read?! Where is the problem?

Recommended Answers

All 3 Replies

Well, i find the problem myself.
The name of the file "Tutorial.kv" should be in lowercase, so i changed it to "tutorial.kv".

And also there was a little problem in "tutorial.kv" line 6. The ; after None was extra that i deleted.

One of the zillion rules of Kivy:
Kivy looks for a .kv file with the same name as your App class in lowercase
(minus “App” if it ends with ‘App’. eg. TutorialApp -> tutorial.kv)

Compared to Python syntax, Kivy syntax really sucks.

I would only use it if you have a touch sensitive screen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.