Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello β I'm @olemoritz on Twitter.
File where the speech is saved
-
@Python567 sincerely, I don't understand what you don't understand.
Please post only your def init, no more -
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
-
@cvp that is much more than I have before. After
with ui.Image.Context...
everything was wrong. But now we have it, π -
-
sorry, but I like to joke
-
@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
-
-
@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
-
@cvp it works! And if i want the numbers to be thicker, what have I to do?
-
@Python567 said:
numbers to be thicker,
You have to select another font, by example 'Arial Rounded MT Bold'
-
@cvp ok great, thanks
-
@cvp hi, your clock works wonderfull. But around the clock is a white square. Can I remove this?
-
@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'
-
@cvp ok, thanks