kivy label markup

23 views
Skip to first unread message

Degenerate Tech

unread,
Apr 4, 2024, 7:53:14 AMApr 4
to Kivy users support
In kivy markup language the size of the text can be change by tag [size=10] hello [/size]
.and fine but size=10 may be different for different screen size so is there any way to implement sp()  dp() like ? as in label ?

elli...@cox.net

unread,
Apr 4, 2024, 9:23:22 AMApr 4
to Kivy users support
You can us an f-string to set the size.

from kivy.app import App
from kivy.lang import Builder

kv =
"""
Label:
   markup: True
   text: f'Default size, [size={int(sp(40))}]BIG[/size], default'
"""


class ScaleMarkupApp(App):
   
def build(self):
       
return Builder.load_string(kv)


ScaleMarkupApp().run()


From: kivy-...@googlegroups.com <kivy-...@googlegroups.com> on behalf of Degenerate Tech <sksah...@gmail.com>
Sent: Thursday, April 4, 2024 4:53 AM
To: Kivy users support <kivy-...@googlegroups.com>
Subject: [kivy-users] kivy label markup
 
In kivy markup language the size of the text can be change by tag [size=10] hello [/size]
.and fine but size=10 may be different for different screen size so is there any way to implement sp()  dp() like ? as in label ?

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/bdd232d4-0172-4b30-bad6-1401b615397en%40googlegroups.com.

Degenerate Tech

unread,
Apr 4, 2024, 9:46:29 AMApr 4
to Kivy users support
Thanks
Reply all
Reply to author
Forward
0 new messages