Created
June 7, 2020 17:56
-
-
Save tshirtman/089f3fbb63fceceb89e81fb03cc6d33c to your computer and use it in GitHub Desktop.
showing the usage of - before a property rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.lang import Builder | |
from kivy.factory import Factory | |
from kivy import properties as P | |
KV = ''' | |
<CustomLabel@Label>: | |
font_size: app.font_size1 | |
<CustomLabel2@CustomLabel>: | |
font_size: app.font_size2 | |
<CustomLabel3@CustomLabel>: | |
-font_size: app.font_size2 | |
BoxLayout: | |
orientation: 'vertical' | |
CustomLabel: | |
text: 'CustomLabel' | |
CustomLabel2: | |
text: 'CustomLabel2' | |
CustomLabel3: | |
text: 'CustomLabel3' | |
Slider: | |
value: app.font_size1 | |
min: 0 | |
max: 100 | |
step: 1 | |
on_value: app.font_size1 = self.value | |
Slider: | |
value: app.font_size2 | |
min: 0 | |
max: 100 | |
step: 1 | |
on_value: app.font_size2 = self.value | |
''' | |
class Application(App): | |
font_size1 = P.NumericProperty(10) | |
font_size2 = P.NumericProperty(10) | |
def build(self): | |
return Builder.load_string(KV) | |
if __name__ == "__main__": | |
Application().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment