Untitled
unknown
plain_text
4 years ago
1.4 kB
9
Indexable
from kivy.app import App from math import sqrt from kivy.core.window import Window from kivy.lang.builder import Builder from kivy.properties import NumericProperty KV = ''' BoxLayout: size: self.size pos: self.pos orientation: 'vertical' ScrollView: GridLayout: cols: 1 size_hint_y: None height: self.minimum_height size_hint: 1, None Label: id: label1 halign: 'right' size_hint: 1, None height: self.texture_size[1] text_size: self.width, None text: "אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת" font_name: 'DejaVuSans' font_size: app.font_size*80/25 pos_hint: {"x": -0.15, "y": 0.05} ''' class MainApp(App): font_size = NumericProperty() def __init__(self, **kwargs): super(MainApp, self).__init__(**kwargs) self.font_size = 25 def win_cb(self, window, width, height): new_size = sqrt(width**2 + height**2)/40.6 MainApp().font_size = new_size def build(self): Window.bind(on_resize=self.win_cb) self.screen = Builder.load_string(KV) return self.screen MainApp().run()
Editor is loading...