更新时间:2022-06-22 22:14:16
.kv的结构看起来不正确,例如,观察到有很多根会导致另一个问题,因此如果您想要告诉您问题原因的答案,您应该改进缩进.
The structure of your .kv does not look correct, for example it is observed that there are many roots that would cause you another problem, so if you want a response that tells you the reason for your problem you should improve your indentation.
相反,我将向您显示一个正确的.kv,其中根目录为BoxLayout,您的孩子为ID时间为Label的标签:
Instead I'll show you a correct .kv where the root will be the BoxLayout and your child the Label with id time:
clock.kv
<Label>:
font_name: 'Roboto'
font_size: 60
markup: True
BoxLayout:
orientation: 'vertical'
Label:
id: time
text: '[b]00[/b]:00:00'
main.py
from kivy.app import App
from kivy.clock import Clock
from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.utils import get_color_from_hex
from time import strftime
class ClockApp(App):
def on_start(self):
Clock.schedule_interval(self.update, 0)
def update(self, *args):
self.root.ids.time.text = strftime('[b]%H[/b]:%M:%S')
if __name__ == '__main__':
Window.clearcolor = get_color_from_hex('#101216')
LabelBase.register(name='Roboto', fn_regular='Roboto-Thin.ttf', fn_bold='Roboto-Medium.ttf')
ClockApp().run()
Django South迁移引发错误' module'对象没有属性' SET_NULL'
AttributeError:' super'对象没有属性' __ getattr __'
TypeError:' JavaPackage'对象不可调用& amp;在类路径中找不到Spark Streaming的Kafka库
PyMongo Aggregation&Quot;AttributeError:';dict';对象没有属性';_TXN_READ_PERPERY';&QOT;
cordovaSQLite无法正常工作,错误:未定义不是对象(正在评估' n.transaction')
AttributeError:' NoneType'对象没有属性' text'在python中