Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created February 7, 2022 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/4e9d75f4810a94704d81922436b5b210 to your computer and use it in GitHub Desktop.
Save tshirtman/4e9d75f4810a94704d81922436b5b210 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
KV = '''
<BorderBoxLayout@BoxLayout,BorderGridLayout@GridLayout,CanvasButton@Label+ButtonBehavior,BorderLabel@Label>:
border_width: 1
canvas.before:
Line:
rectangle: self.pos + self.size
width: self.border_width or 1
<BorderBoxLayout,BorderGridLayout>:
size: self.minimum_size
size_hint: None, None
<CanvasButton>:
size: "80dp", self.texture_size[1]
font_size: "30sp"
size_hint: None, None
FloatLayout:
BorderBoxLayout:
pos_hint: {'center': (.5, .5)}
orientation: 'vertical'
size_hint: None, None
border_width: 4
BorderLabel:
id: weight
size_hint_y: None
height: "30sp"
font_size: "30sp"
border_width: 2
BorderGridLayout:
cols: 3
border_widh: 2
CanvasButton:
text: "7"
CanvasButton:
text: "8"
CanvasButton:
text: "9"
CanvasButton:
text: "4"
CanvasButton:
text: "5"
CanvasButton:
text: "6"
CanvasButton:
text: "1"
CanvasButton:
text: "2"
CanvasButton:
text: "3"
CanvasButton:
text: "0"
CanvasButton:
text: "lbs"
CanvasButton:
text: "«"
BorderBoxLayout:
border_width: 2
size_hint_x: 1
CanvasButton:
text: "EXIT"
size_hint_x: 1
CanvasButton:
text: "ENTER"
size_hint_x: 1
'''
class Application(App):
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