Created
June 14, 2013 00:19
-
-
Save inclement/5778531 to your computer and use it in GitHub Desktop.
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
class NumberChooser(BoxLayout): | |
number = NumericProperty(0) | |
number_max = NumericProperty(9) | |
number_min = NumericProperty(0) | |
def increment(self): | |
if self.number < self.number_max: | |
self.number += 1 | |
def decrement(self): | |
if self.number > self.number_min: | |
self.number -= 1 |
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
NumberChooser>: | |
orientation: 'horizontal' | |
Button: | |
size_hint_x: None | |
width: self.parent.height | |
on_press: root.decrement() | |
canvas: | |
Line: | |
points: [self.x + 0.15*self.width,self.y+0.5*self.height,self.x+0.85*self.width,self.y+0.5*self.height] | |
width: 2 | |
cap: 'square' | |
Label: | |
font_size: (0.9*self.height,'px') | |
text: str(root.number) | |
Button: | |
size_hint_x: None | |
width: self.parent.height | |
on_press: root.increment() | |
canvas: | |
Line: | |
points: [self.x + 0.15*self.width,self.y+0.5*self.height,self.x+0.85*self.width,self.y+0.5*self.height] | |
width: 2 | |
cap: 'square' | |
Line: | |
points: [self.x + 0.5*self.width,self.y+0.15*self.height,self.x+0.5*self.width,self.y+0.85*self.height] | |
width: 2 | |
cap: 'square' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment