I post this only for people learning like me. Even if it can be done a lot better we go through a learning curve.
import ui
import time
'''
this code is not to be considered serious,
more the idea than anything else.
For new guys like me learning...
'''
@ui.in_background
def btn_font_animation(sender):
start = int(sender.font[1])+1
finish = int(start * 1.4)
for i in range(start,finish,2):
sender.font = (sender.font[0],i)
time.sleep(.02)
for i in range(finish,start,-1):
sender.font = (sender.font[0],i)
time.sleep(.01)
sender.font = (sender.font[0], start)
if __name__ == '__main__':
v = ui.View(name = 'Button Font Animation Test')
v.frame = (0,0,540,576)
v.background_color = 'red'
btn = ui.Button(title = 'Press Me')
btn.width, btn.height = 300,100
btn.x = (v.width / 2 ) - (btn.width / 2)
btn.y = (v.height / 2 ) - (btn.height /2) - 45
btn.border_width = .5
btn.tint_color = 'white'
btn.font = ('<system-bold>', 36)
btn.action = btn_font_animation
v.add_subview(btn)
v.present('sheet')