from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import StringProperty
class main(BoxLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
x = StringProperty("hello")
pass
class app(App):
def build(self):
pass
app().run()
Python kodu
main:
<main>:
Label:
text: root.x
Kv dosyası
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 696, in _apply_rule
setattr(widget_set, key, value)
File "kivy/weakproxy.pyx", line 35, in kivy.weakproxy.WeakProxy.__setattr__
File "kivy/properties.pyx", line 497, in kivy.properties.Property.__set__
File "kivy/properties.pyx", line 541, in kivy.properties.Property.set
File "kivy/properties.pyx", line 532, in kivy.properties.Property.set
File "kivy/properties.pyx", line 698, in kivy.properties.StringProperty.check
ValueError: Label.text accept only str
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/storage/emulated/0/Python/clock/main.py", line 14, in <module>
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/app.py", line 828, in run
self.load_kv(filename=self.kv_file)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/app.py", line 599, in load_kv
root = Builder.load_file(rfilename)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 301, in load_file
return self.load_string(data, **kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 401, in load_string
widget.apply_class_lang_rules(
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/uix/widget.py", line 467, in apply_class_lang_rules
Builder.apply(
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 536, in apply
self._apply_rule(
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 705, in _apply_rule
raise BuilderException(rule.ctx, rule.line,
kivy.lang.builder.BuilderException: Parser: File "/storage/emulated/0/Python/clock/app.kv", line 4:
...
2:<main>:
3: Label:
>> 4: text: root.x
...
ValueError: Label.text accept only str
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/kivy/lang/builder.py", line 696, in _apply_rule
setattr(widget_set, key, value)
File "kivy/weakproxy.pyx", line 35, in kivy.weakproxy.WeakProxy.__setattr__
File "kivy/properties.pyx", line 497, in kivy.properties.Property.__set__
File "kivy/properties.pyx", line 541, in kivy.properties.Property.set
File "kivy/properties.pyx", line 532, in kivy.properties.Property.set
File "kivy/properties.pyx", line 698, in kivy.properties.StringProperty.check
Hata metni
Labelde güncel saatin yazmasını istiyorum ve bunun için bir string değeri kullanıp bu değeri her 0.5 saniyede bir kivy.clock ile anlık zamana eşitleyip labelde göstermek istiyorum ama böyle bir hata alıyorum