I am trying to build an application with buttons (similar to the calculator), everything was good until I tries to make the app window thinner, the text go out the borders of the button.
I tried font_size: self.width/5
to change the font with the screen size but it works in one situation (width or height) I also found a code
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
class MyLabel(Image):
text = StringProperty('')
def on_text(self, *_):
# Just get large texture:
l = Label(text=self.text)
l.font_size = '1000dp' # something that'll give texture bigger than phone's screen size
l.texture_update()
# Set it to image, it'll be scaled to image size automatically:
self.texture = l.texture
class RootWidget(BoxLayout):
pass
class TestApp(App):
def build(self):
return MyLabel(text='Test test test')
if __name__ == '__main__':
TestApp().run()
that solved this problem but it was using Image in kivy and I don't know how to use it in my situation or in the kv file.
Currently texts are like this:
THANKS!