I have copied these 2 files of code from a website.


from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from kivy.properties import StringProperty

import datetime

class Counter_Timer(BoxLayout):
    def update(self, dt):
            delta = datetime.datetime(2015, 9, 13, 3, 5) - datetime.datetime.now()
            self.days = delta.days
            hour_string = str(delta).split(',')[1]
            self.hours = hours_string.split(':')[0]
            self.minuts = hours_string.split(':')[1]
            self.seconds = hours_string.split(':')[2].split('.')[0]
            return days, hours, minuts, seconds

class Counter(App):
    def build(self):
        counter = Counter_Timer
        Clock.schedule_interval(counter.update, 1.0)
        days = StringProperty()
        hours = StringProperty()
        minutes = StringProperty()
        seconds = StringProperty()

if __name__ == "__main__":

There was written:
"Let's add them to the Counter_timer class:"

days = StringProperty()
hours = StringProperty()
minutes = StringProperty()
seconds = StringProperty()

So i added it into the def build. correct place,right?
And i add it myself, but i'm not sure if it's correct or not:
from kivy.properties import StringProperty

And here is the next file counter.kv:

    orientation: 'vertical'
        text: 'Vacation starts in:'
        font_size: '46dp'
        text: root.days + ' Days'
        font_size: '46dp'
        text: root.hours + ' Hours'
        font_size: '38dp'
        text: root.minuts + ' Minuts'
        font_size: '30dp'
        text: root.seconds + ' Seconds'
        font_size: '22dp'

When i run it, i get this error:

[INFO   ] Kivy v1.8.0
Purge log fired. Analysing...
Purge 4 log files
Purge finished !
[INFO   ] [Logger      ] Record log in /home/niloofar/.kivy/logs/kivy_15-02-24_5.txt
[INFO   ] [Factory     ] 157 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif 
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[INFO   ] [Text        ] Provider: pygame
[DEBUG  ] [App         ] Loading kv <./counter.kv>
[CRITICAL] [Application ] No window is created. Terminating application run.

What should i do?

Error messages are poor with .kv files.
One reason I don't like them.
Check your log file.

Edited 1 Year Ago by vegaseat

This question has already been answered. Start a new discussion instead.