Rugen
Rugen

Reputation: 57

AssertionError - Kivy

I'm fairly new to Python and Kivy. I'm trying to write a Python (3.7) program that creates a Kivy (1.11.1) display and updates the information every 30 minutes. I'm running into 2 issues that I can't figure out.

  1. I get an AssertionError at the time of creation of the Kivy display.

    File "C:\Users\user\Anaconda3\lib\site-packages\kivy\lang\builder.py", line 554, in _apply_rule assert(rule not in self.rulectx)

    AssertionError

  2. I get a warning that my Kivy language file is loaded multiple times

I reduced my program down to the essential information that still causes the error and warning:

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty

class TheBox(FloatLayout):
    Day3 = ObjectProperty()
    Day2 = ObjectProperty()
    LastUpdate = ObjectProperty()

    def updateData(self):
        self.Day3.text = SE_days[0]
        self.Day2.text = SE_days[1]
        self.LastUpdate.text = 'Last Updated at: ' + SO_lastUpdate        

timeInterval = 30 #minutes
SE_days = ['4/3', '4/4']
SO_lastUpdate = '4/5 1:31 PM'

class DisplayTestApp(App):

    def build(self):
        x = TheBox()
        x.updateData()
        Clock.schedule_interval(x.update, timeInterval*60)
        return TheBox()

if __name__ == '__main__':
    DisplayTestApp().run()

And my Kivy language file:

#:kivy 1.11.1

<TheBox>:
    FloatLayout:
        FloatLayout:
            Label:
                id: Day3
                size_hint: .4, .1
                font_size: '24sp'
                color: (1, 1, 1)
                halign: 'right'
                pos_hint: {'right': .45, 'center_y': .5}
                text:
            Label:
                id: Day2
                size_hint: .4, .1
                font_size: '24sp'
                color: (1, 1, 1)
                halign: 'right'
                pos_hint: {'right': .45, 'center_y': .3}
                text:
        FloatLayout:
            Label:
                id: LastUpdate
                size_hint: .9, .2
                pos_hint: {'center_x': .5, 'center_y': .3}
                font_size: '18sp'
                color: (1, 1, 1)
                halign: 'center'
                text:

What am I doing wrong?

Upvotes: 1

Views: 378

Answers (1)

Rugen
Rugen

Reputation: 57

Nevermind...

Evidently I was having trouble with Spyder/Anaconda. I restarted the IDE and the AssertionError and warning are gone.

Upvotes: 1

Related Questions