Forum Archive

File where the speech is saved

Python567

I found in the documentation a example code:


import speech
import sound
import dialogs

# Record an audio file using sound.Recorder:
recorder = sound.Recorder('speech.m4a')
recorder.record()
# Continue recording until the 'Finish' button is tapped:
dialogs.alert('Recording...', '', 'Finish', hide_cancel_button=True)
recorder.stop()
try:
    result = speech.recognize('speech.m4a')
    print('=== Details ===')
    print(result)
    print('=== Transcription ===')
    print(result[0][0])

except RuntimeError as e:
    print('Speech recognition failed: %s' % (e,))

On line 12 ther is a speech.m4a is that the File where the Speech is saved and if yes can I delete the file and where is this one?

cvp

@Python567 sound.recorder writes the file and speech.recognize reads the file.
It is in the same folder as the script. And of course you can delete it

Python567

@cvp ok, thanks for the fast answer🙂

Python567

@cvp an other question: Can the speech or sound module listen and know what I say if he listen during I ask what I say?

cvp

@Python567 said:

Can the speech or sound module listen and know what I say if he listen during I ask what I say?

Not understood/non compris/no comprendo/no capito....

Python567

@cvp so, the modul listen to me every time. Can I find out what I say if the modul don‘t stop to listen to me?

cvp

@Python567 the sound module records what you say, it does not really listen to you, and that until you stop it.

Python567

ok, so if I want that the module check all five minutes what I say, I must stop it every five minutes to check it`?

cvp

@Python567 yes but I wonder if @JonB didn't write a script to do this in real time...

Python567

@cvp @JonB write this module

cvp

@Python567 you could read this topic but don't hope much help

Python567

@cvp I have a code that aks all 5 seconds if I say something. But I get an error after the print is finish.
````
import time
import sound
import speech

timestamp = time.time()

recorder = sound.Recorder('speech.m4a')
recorder.record()

while True:

    if timestamp - time.time() <= -5:
        recorder.stop()
        result = speech.recognize('speech.m4a', 'de_DE')


        if result[0][0] == 'Hallo':
            print('Du hast hallo gesagt')

            recorder.record()
cvp

@Python567 two modifs

import time
import sound
import speech

timestamp = time.time() 

recorder = sound.Recorder('speech.m4a')
recorder.record()

while True:
        time.sleep(1)
        if timestamp - time.time() <= -5:
            recorder.stop()
            result = speech.recognize('speech.m4a', 'de_DE')


            if result[0][0] == 'Hallo':
                print('Du hast hallo gesagt')
                timestamp = time.time() 
                recorder.record()
Python567

@cvp thanks, that‘s great

Python567

@cvp is it normal that my Pythonista crash sometimes? I have a skript with over 18 000 lines. Is that a problem? And how can I update a button every second for my clock?

cvp

@Python567 try

import ui
import datetime

class MyView(ui.View):
    def __init__(self):
        self.frame = (0,0,400,400)
        self.background_color = 'white'
        b = ui.Button(name='b')
        b.border_width = 1
        b.border_color = 'blue'
        b.frame = (10,10,250,20)
        self.add_subview(b)
        self.update_interval = 1
    def update(self):
        self['b'].title = str(datetime.datetime.now())

v = MyView()
v.present('sheet')
cvp

@Python567 said:

is it normal that my Pythonista crash sometimes?

It can be normal if you script uses a lot of memory and you re-run it several times without clearing it.
It happens frequently that I have to kill Pythonista and restart it when I use a big script or a script using a lot of images, by example.

cvp

@Python567 other example, try it

import ui
import datetime
from math import pi,cos,sin

class ClockButton(ui.View):           
    def __init__(self, seconds=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.seconds = seconds
        self.background_color = 'white'
        b = ui.Button(name='clock')
        b.frame = (0,0,self.width,self.height)
        b.corner_radius = self.width/2
        b.border_color = 'black'
        b.border_width = 1
        b.bg_color = 'lightgray'
        b.title = ''
        b.tint_color = 'red'
        b.background_image = None
        self.add_subview(b)

        self.update_interval = 1 if self.seconds else 60
    def update(self):
        t = datetime.datetime.utcnow()
        tick = -2 * pi / 60.0
        seconds = t.second + t.microsecond/1000000.0
        minutes = t.minute + seconds/60.0
        hours = (t.hour % 12) + minutes/60.0
        r = self.width/2
        with ui.ImageContext(r * 2, r * 2) as ctx:
            pthc = ui.Path.oval(r*0.9,r*0.9,r*0.2,r*0.2)
            ui.set_color('black')
            pthc.fill()
            pth = ui.Path()
            ui.set_color('black')
            pth.line_width = 2
            # hours
            lh = 0.6                                                # length of hours hand
            ah = -pi/2 + hours*(2*pi/12)        # angle  of hours hand
            pth.move_to(r,r)
            pth.line_to(r*(1+lh*cos(ah)),r*(1+lh*sin(ah)))
            # minutes
            lm = 0.9                                                # length of minutes hand
            am = -pi/2 + minutes*(2*pi/60)  # angle  of minutes hand        
            pth.move_to(r,r)
            pth.line_to(r*(1+lm*cos(am)),r*(1+lm*sin(am)))
            pth.stroke()
            # seconds
            if self.seconds:
                lt = 0.9                                                # length of seconds hand
                at = -pi/2 + seconds*(2*pi/60)  # angle  of seconds hand
                pths = ui.Path()
                ui.set_color('red')
                pths.move_to(r,r)
                pths.line_to(r*(1+lt*cos(at)),r*(1+lt*sin(at)))
                pths.stroke()
            ui_image = ctx.get_image()
        self['clock'].background_image = ui_image


v = ui.View()
v.background_color = 'white'
v.frame = (0,0,400,400)
clock = ClockButton(frame=(10,10,32,32))
v.add_subview(clock)
v.present('sheet')
Python567

@cvp wow, the second example is better 👍. And if I want the numbers, where can I add them?

cvp

@Python567 said:

the numbers, where can I add them

Do you mind the numbers 1 to 12 on the circle?

Python567

@cvp yes

cvp

@Python567 wait....

cvp

@Python567 try

import ui
import datetime
from math import pi,cos,sin

class ClockButton(ui.View):           
    def __init__(self, r, seconds=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.r = r
        self.seconds = seconds
        self.background_color = 'white'
        self.frame = (0,0,self.r*2,self.r*2)
        b = ui.Button(name='clock')
        b.frame = (0,0,self.width,self.height)
        b.corner_radius = self.width/2
        b.border_color = 'black'
        b.border_width = 1
        b.bg_color = 'lightgray'
        b.title = ''
        b.tint_color = 'red'
        b.background_image = None
        self.add_subview(b)
        self.update_interval = 1 if self.seconds else 60
        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
            ui.set_color('black')
            pthc.fill()
            h = 10
            for i in range(12):
                a = pi/2 - 2 * pi * i/12.0
                x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
                ui.draw_string(str(i),rect=(x,y,20,h),font=('Menlo',h))
            self.back = ctx.get_image()

    def update(self):
        t = datetime.datetime.utcnow()
        tick = -2 * pi / 60.0
        seconds = t.second + t.microsecond/1000000.0
        minutes = t.minute + seconds/60.0
        hours = (t.hour % 12) + minutes/60.0
        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            self.back.draw(0,0,self.r * 2, self.r * 2)
            pth = ui.Path()
            ui.set_color('black')
            pth.line_width = 2
            # hours
            lh = 0.6                                                # length of hours hand
            ah = -pi/2 + hours*(2*pi/12)        # angle  of hours hand
            pth.move_to(self.r,self.r)
            pth.line_to(self.r*(1+lh*cos(ah)),self.r*(1+lh*sin(ah)))
            # minutes
            lm = 0.9                                                # length of minutes hand
            am = -pi/2 + minutes*(2*pi/60)  # angle  of minutes hand        
            pth.move_to(self.r,self.r)
            pth.line_to(self.r*(1+lm*cos(am)),self.r*(1+lm*sin(am)))
            pth.stroke()
            # seconds
            if self.seconds:
                lt = 0.9                                                # length of seconds hand
                at = -pi/2 + seconds*(2*pi/60)  # angle  of seconds hand
                pths = ui.Path()
                ui.set_color('red')
                pths.move_to(self.r,self.r)
                pths.line_to(self.r*(1+lt*cos(at)),self.r*(1+lt*sin(at)))
                pths.stroke()
            ui_image = ctx.get_image()
        self['clock'].background_image = ui_image


v = ui.View()
v.background_color = 'white'
v.frame = (0,0,400,400)
clock = ClockButton(64,seconds=True)
v.add_subview(clock)
v.present('sheet')
cvp

@Python567 I've just updated the last script above to create fixed part of the clock (circle, digits) in the init def.

Python567

@cvp ok, but is it possible that it‘s in your country 7:50?

cvp

@Python567 no, 08:50

Python567

Ok, because on my clock, the little cursor is on the 8

cvp

@Python567 sorry, replace utcnow by now

Python567

@cvp what must I replace to what?
Edit: I have it, thanks

cvp

@Python567 if you want the date in your clock, replace the graphic part of the init by

        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
            pthc.fill()
            h = 12
            w = 5*h
            t = f"{datetime.datetime.now():%m/%d/%y}"
            x = self.r - w/2
            y = self.r - r/2
            pthr = ui.Path.rect(x,y,w,h)
            ui.set_color('white')
            pthr.fill()
            ui.set_color('black')
            ui.draw_string(t,rect=(x,y,w,h),font=('Menlo',h))
            for i in range(12):
                a = pi/2 - 2 * pi * i/12.0
                x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
                ui.draw_string(str(i),rect=(x,y,2*h,h),font=('Menlo',h))
            self.back = ctx.get_image()

cvp

And now, use your creativity to invent your own clock, path allow all what you imagine.
Try with a personal photo as background of the clock...

Python567

@cvp yes I try, thanks for the start code

cvp

@Python567 and don't forget, this clock stays a button, you can set it's own action with this kind of lines added at end of init def.

        b.action = self.action

    def action(self,sender):
        print('clock has been pressed')
cvp

@Python567 Nice, isn' it? I put the picture of my wife, only as example 😂

        self.update_interval = 1 if self.seconds else 60
        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            ui.Image.named('test:Lenna').draw(0,0,self.r * 2, self.r * 2)
            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)

Python567

@cvp yes really nice, only one thing, why do tint_color = 'white' don't work? (I would to change the color from the numbers and the from coursers)

cvp

@Python567 tint_color is for button.title, not used here

Draw_string has its own color parameter
Lines need a set_color

Thus, try in init def

            ui.draw_string(t,rect=(x,y,w,h),font=('Menlo',h), color='black')
            for i in range(12):
                a = pi/2 - 2 * pi * i/12.0
                x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
                ui.draw_string(str(i),rect=(x,y,2*h,h),font=('Menlo',h), color='white')
            self.back = ctx.get_image()

And, in update def

        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            self.back.draw(0,0,self.r * 2, self.r * 2)
            pth = ui.Path()
            ui.set_color('white')

Python567

@cvp so, that was really dificult. But I have it👍. The big round circle in the middle where can I change the color there? And the action button doesn't work. And with the date there is a problem too (I replace my piece code with your code but it don't work).

cvp

@Python567 For me all works, thus you did change something, please post your code.
For the color of the circle it-self, I'll check.

cvp

@Python567 said:

The big round circle in the middle where can I change the color

            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
            ui.set_color('blue')
            pthc.fill()

cvp

If you don't want this filled circle, you have only to comment/remove these 3 lines

Python567

@cvp here my code:
````
import ui
import datetime
from math import pi,cos,sin

class ClockButton(ui.View):
def init(self, r, seconds=True, args, kwargs):
super().init(
args, kwargs)
self.r = r
self.seconds = seconds
self.background_color = 'white'
self.frame = (0,0,self.r
2,self.r
2)
b = ui.Button(name='clock')
b.frame = (0,0,self.width,self.height)
b.corner_radius = self.width/2
b.border_color = 'black'
b.border_width = 1
b.bg_color = 'lightgray'
b.title = ''
b.tint_color = 'red'
#b.action = self.action

            #def action(self, sender):
                #print('Uhr wurde gedrückt')

            b.background_image = None
            self.add_subview(b)
            self.update_interval = 1 if self.seconds else 60
            with ui.ImageContext(self.r * 2, self.r * 2) as ctx:

                    pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
                    ui.set_color('black')
                    pthc.fill()
                    h = 10
                    for i in range(12):
                        a = pi/2 - 2 * pi * i/12.0
                        x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
                        ui.draw_string(str(i),rect=(x,y,20,h),font=('Menlo',h), color='white')
                    self.back = ctx.get_image()


                #ui.draw_string(t,rect=(x,y,w,h),font=('Menlo',h), color='black')
                    #for i in range(12):
                        #a = pi/2 - 2 * pi * i/12.0
                        #x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h2
                        #ui.draw_string(str(i),rect=(x,y,2*h,h),font=('Menlo',h), color='white')
                    #self.back = ctx.get_image()

            #b.action = self.action


            def action(self, sender):
                print('Uhr wurde gedrückt')


    def update(self):
            t = datetime.datetime.now()
            tick = -2 * pi / 60.0
            seconds = t.second + t.microsecond/1000000.0
            minutes = t.minute + seconds/60.0
            hours = (t.hour % 12) + minutes/60.0


            with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
                    ui.Image.named('IMG_1147.jpeg').draw(0,0,self.r * 2, self.r * 2)
                    self.back.draw(0,0,self.r * 2, self.r * 2)
                    pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
                    ui.set_color('black')

                    pth = ui.Path()
                    ui.set_color('white')
                    pth.line_width = 2
                    # hours
                    lh = 0.6                                                # length of hours hand
                    ah = -pi/2 + hours*(2*pi/12)        # angle  of hours hand
                    pth.move_to(self.r,self.r)
                    pth.line_to(self.r*(1+lh*cos(ah)),self.r*(1+lh*sin(ah)))
                    # minutes
                    lm = 0.9                                                # length of minutes hand
                    am = -pi/2 + minutes*(2*pi/60)  # angle  of minutes hand        
                    pth.move_to(self.r,self.r)
                    pth.line_to(self.r*(1+lm*cos(am)),self.r*(1+lm*sin(am)))
                    pth.stroke()
                    # seconds
                    if self.seconds:
                            lt = 0.9                                                # length of seconds hand
                            at = -pi/2 + seconds*(2*pi/60)  # angle  of seconds hand
                            pths = ui.Path()
                            ui.set_color('red')
                            pths.move_to(self.r,self.r)
                            pths.line_to(self.r*(1+lt*cos(at)),self.r*(1+lt*sin(at)))
                            pths.stroke()
                    ui_image = ctx.get_image()


            self['clock'].background_image = ui_image

v = ui.View()
v.background_color = 'white'
v.frame = (0,0,400,400)
clock = ClockButton(94,seconds=True)
v.add_subview(clock)
v.present('sheet')

cvp

@Python567 your def action was incorrectly indented

                b.action = self.action


        def action(self, sender):
            print('Uhr wurde gedrückt')

        def update(self):
cvp

@Python567 said:

And with the date there is a problem too

You have commented it.

cvp

@Python567 and why did you put the draw Image in the def update? It will be done each second...

You did change my code....

Python567

@cvp where should I put it, and when I activate the commented out one again, there is an error: name "t" is not defined.

why did you put the draw Image in the def update? It will be done each second...
I don‘t found an other way

Python567

@cvp I try to do it in the __init__ but it don‘t work

cvp

@Python567 Please, copy and paste my code, try it without changing anything.
If something is wrong, tell me.
If all is ok, try to modify one thing at a time, test it and if it is not ok, be sure it comes from your modif, try to debug your-self and if you can't, ask help.
Sorry, but it is difficult to help via the forum if you change a lot.

Python567

@cvp It‘s for me only difficult to add different code on different places

cvp

@Python567 I understand but you can try your modif on a little script like mine.
It is only to help you to find the right way to modify and debug a modification.
Always, try to work by little scripts, not your big one.

Python567

@cvp I have a small skript for that. Ok, I start to modify my skript.

cvp

@Python567 it was an advice, not an obligation 😉

Python567

@cvp in one of the post you write the code with that I can import my picture as the background, but you don‘t say where I must write this in my sript. Where is the place for that in my code?

cvp

@Python567 in my original script, replace

ui.Image.named('test:Lenna')......

By

ui.Image.named('your.jpg').....

without changing the place of the line

Python567

@cvp where in the skript?? IN the update def, in the init, where?

cvp

@Python567 did you noT see it in the update def?

cvp

Did you start from my last big script? Where you can add the lines for action
Or do you want a new entire script?

Python567

@cvp I start form you last big skript. In the update def I don‘t see it. My Skript:
```
import ui
import datetime
from math import pi,cos,sin

class ClockButton(ui.View):
def init(self, r, seconds=True, args, kwargs):
super().init(
args, kwargs)
self.r = r
self.seconds = seconds
self.background_color = 'white'
self.frame = (0,0,self.r
2,self.r
2)
b = ui.Button(name='clock')
b.frame = (0,0,self.width,self.height)
b.corner_radius = self.width/2
b.border_color = 'black'
b.border_width = 1
b.bg_color = 'lightgray'
b.title = ''
b.tint_color = 'red'
b.background_image = None
self.add_subview(b)
self.update_interval = 1 if self.seconds else 60

    ui.Image.named('IMG_1147.jpeg').draw(0,0,self.r * 2, self.r * 2)
    pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)


    with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
        #pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
        #ui.set_color('white')
        #pthc.fill()
        h = 10
        for i in range(12):
            a = pi/2 - 2 * pi * i/12.0
            x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
            ui.draw_string(str(i),rect=(x,y,20,h),font=('Menlo',h), color = 'white')
        self.back = ctx.get_image()

    b.action = self.action

def action(self,sender):
    print('clock has been pressed')

def update(self):
    t = datetime.datetime.now()
    tick = -2 * pi / 60.0
    seconds = t.second + t.microsecond/1000000.0
    minutes = t.minute + seconds/60.0
    hours = (t.hour % 12) + minutes/60.0

    with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
        self.back.draw(0,0,self.r * 2, self.r * 2)
        pth = ui.Path()
        ui.set_color('white')
        pth.line_width = 2
        # hours
        lh = 0.6                                                # length of hours hand
        ah = -pi/2 + hours*(2*pi/12)        # angle  of hours hand
        pth.move_to(self.r,self.r)
        pth.line_to(self.r*(1+lh*cos(ah)),self.r*(1+lh*sin(ah)))
        # minutes
        lm = 0.9                                                # length of minutes hand
        am = -pi/2 + minutes*(2*pi/60)  # angle  of minutes hand        
        pth.move_to(self.r,self.r)
        pth.line_to(self.r*(1+lm*cos(am)),self.r*(1+lm*sin(am)))
        pth.stroke()
        # seconds

        if self.seconds:
            lt = 0.9                                                # length of seconds hand
            at = -pi/2 + seconds*(2*pi/60)  # angle  of seconds hand
            pths = ui.Path()
            ui.set_color('red')
            pths.move_to(self.r,self.r)
            pths.line_to(self.r*(1+lt*cos(at)),self.r*(1+lt*sin(at)))
            pths.stroke()

        ui_image = ctx.get_image()
    self['clock'].background_image = ui_image

v = ui.View()
v.background_color = 'white'
v.frame = (0,0,400,400)
clock = ClockButton(150,seconds=True)
v.add_subview(clock)
v.present('sheet')

Python567

@cvp In the init is something, but that don‘t work with my picture

cvp

@Python567 in my previous post, I wrote

        self.update_interval = 1 if self.seconds else 60
        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            ui.Image.named('test:Lenna').draw(0,0,self.r * 2, self.r * 2)
            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)

Where the draw of image is in the context....

And you put it before 😉

Python567

@cvp I write this code in the init before ui.Image.named...... Is that the right right place, because it don't work?

cvp

@Python567 sincerely, I don't understand what you don't understand.
Please post only your def init, no more

cvp

It should be

    def __init__(self, r, seconds=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.r = r
        self.seconds = seconds
        self.background_color = 'white'
        self.frame = (0,0,self.r*2,self.r*2)
        b = ui.Button(name='clock')
        b.frame = (0,0,self.width,self.height)
        b.corner_radius = self.width/2
        b.border_color = 'black'
        b.border_width = 1
        b.bg_color = 'lightgray'
        b.title = ''
        b.tint_color = 'red'
        b.background_image = None
        self.add_subview(b)
        self.update_interval = 1 if self.seconds else 60
        with ui.ImageContext(self.r * 2, self.r * 2) as ctx:
            ui.Image.named('IMG_1147.jpeg').draw(0,0,self.r * 2, self.r * 2)
            pthc = ui.Path.oval(self.r*0.9,self.r*0.9,self.r*0.2,self.r*0.2)
            ui.set_color('blue')
            pthc.fill()
            h = 12
            w = 5*h
            t = f"{datetime.datetime.now():%m/%d/%y}"
            x = self.r - w/2
            y = self.r - r/2
            pthr = ui.Path.rect(x,y,w,h)
            ui.set_color('white')
            pthr.fill()
            ui.draw_string(t,rect=(x,y,w,h),font=('Menlo',h), color='black')
            for i in range(12):
                a = pi/2 - 2 * pi * i/12.0
                x,y = self.r+cos(a)*(self.r*0.85)-h/2, self.r-sin(a)*(self.r*0.85)-h/2
                ui.draw_string(str(i),rect=(x,y,2*h,h),font=('Menlo',h), color='white')
            self.back = ctx.get_image()
        b.action = self.action
Python567

@cvp that is much more than I have before. After with ui.Image.Context... everything was wrong. But now we have it, 😀

cvp

@Python567 said:

But now we have it,

I already had it 😂
Now, you have it 😉

cvp

sorry, but I like to joke

Python567

@cvp I'm too, no problem😂 Only two questions right now. 1. How can I change the size of the numbers 2. The numbers start with 0 but I want instead the 0 the 12

cvp

@Python567 said:

The numbers start with 0 but I want instead the 0 the 12

            for i in range(1,13):
cvp

@Python567 said:

How can I change the size of the numbers

Instead of

            h = 12

Try, but it depends on your idevice and the size of your button

            h = 16
Python567

@cvp it works! And if i want the numbers to be thicker, what have I to do?

cvp

@Python567 said:

numbers to be thicker,

You have to select another font, by example 'Arial Rounded MT Bold'

Python567

@cvp ok great, thanks

Python567

@cvp hi, your clock works wonderfull. But around the clock is a white square. Can I remove this?

cvp

@Python567 yes we can by commenting one line

class ClockButton(ui.View):           
    def __init__(self, r, seconds=True, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.r = r
        self.seconds = seconds
        #self.background_color = 'white'
Python567

@cvp ok, thanks