A clock with kivy python

Viewed 99

I would like to display the time with kivy. I don't want that the label use the whole page. How can I do ?

I want it to appear the same as in the following photo:

photo

from kivy.app import App
from datetime import datetime
from datetime import timedelta
from kivy.clock import Clock
from kivy.uix.label import Label

class myApp(App):
    def build(self):
        self.now = datetime.now()

        # Schedule the self.update_clock function to be called once a second
        Clock.schedule_interval(self.update_clock, 1)
        self.my_label = Label(text= self.now.strftime('%H:%M:%S'))
        return self.my_label # The label is the only widget in the interface

    def update_clock(self, *args):
        # Called once a second using the kivy.clock module
        # Add one second to the current time and display it on the label
        self.now = self.now + timedelta(seconds = 1)
        self.my_label.text = self.now.strftime('%H:%M:%S')

myApp().run()
0 Answers
Related