Dec-31-2016, 08:57 PM
Hi, I'm trying to access a label in the kv file. I would like it to be a clock.
Currently I have the following code:
Or if I remove the "self", it'll print to the console every second ok.
However I can't get it to change the label automatically.
It says:
Currently I have the following code:
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
import time
from kivy.clock import Clock
class test(BoxLayout):
def showClock(self, dt):
timey = (time.strftime("%H"+":"+"%M"+":"+"%S")),dt
print(timey[0])
self.ids.labelID.text = (timey[0])
event = Clock.schedule_interval(showClock,1)
class question(App):
def build(self):
return test()
if __name__ =="__main__":
question().run()KV file:<test>: id:test BoxLayout: Label: id: labelID text:"label" Button: id: buttonID text:"button" on_release:test.showClock(1)If I comment out the event line.. pressing the button changes the label text ok.
Or if I remove the "self", it'll print to the console every second ok.
However I can't get it to change the label automatically.
It says:
Error:TypeError: showClock() missing 1 required positional argument: 'dt'Any help greatly appreciated!
