from kivy.app import App from kivy.lang import Builder from kivy.uix.label import Label from kivy.clock import Clock import time kv = ''' #:import aika time kelloLabel: id: koe ##text: aika.strftime('%H:%M:%S', aika.localtime()) ''' class kelloLabel(Label): def __init__(self, **kwargs): super(kelloLabel, self).__init__(**kwargs) self.text = time.strftime('%H:%M:%S', time.localtime()) #self.update() def update(self,x): print(time.strftime('%H:%M:%S', time.localtime())) self.text = time.strftime('%H:%M:%S', time.localtime()) class Kokeilu2App(App): def build(self): klabel = Builder.load_string(kv) Clock.schedule_interval(klabel.update, 1) return klabel Kokeilu2App().run()
Sunday, April 10, 2016
Kivy: Muokkaa KV:ta Pythonista
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment