From 6d6149f8516df3efadb29eb1f5e38de7fb457afd Mon Sep 17 00:00:00 2001 From: Adrian Reza <adrianreza96@gmail.com> Date: Wed, 25 Jan 2017 11:14:52 -0600 Subject: [PATCH] Program completed --- main.py | 23 ++++++++++++++++++++++- order.kv | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index da72251..adef673 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ from kivy.app import App from kivy.modules import inspector # For inspection. from kivy.core.window import Window # For inspection. - +from kivy.properties import NumericProperty __app_package__ = 'edu.unl.cse.soft161.order' __app__ = 'Order Meal' __version__ = '0.1' @@ -12,6 +12,27 @@ class OrderApp(App): def build(self): inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). + money = NumericProperty(10) + total_price = NumericProperty(0) + chicken_price = 4 + ham_price= 4 + + def chicken_buy(self): + self.total_price+=4 + + def beef_buy(self): + self.total_price+=4 + + def ham_buy(self): + self.total_price+=4 + + def checkout(self): + self.money=self.money-self.total_price + self.total_price=0 + + + + if __name__ == '__main__': app = OrderApp() diff --git a/order.kv b/order.kv index d23f974..4e05063 100644 --- a/order.kv +++ b/order.kv @@ -1,4 +1,57 @@ BoxLayout: orientation: 'vertical' Label: - text: '[Your meal-ordering GUI here]' + text: 'UNL Sandwich Shop' + BoxLayout: + Label: + + size_hint: (1, 0.25) + text: 'Chicken' + Button: + id: chicken_purchase_button + size_hint: (1, 0.25) + text: 'Purchase' + on_press: app.chicken_buy() + + BoxLayout: + Label: + + size_hint: (1, 0.25) + text: 'Beef' + Button: + id: beef_purchase_button + size_hint: (1, 0.25) + text: 'Purchase' + on_press: app.beef_buy() + + BoxLayout: + Label: + + size_hint: (1, 0.25) + text: 'Ham' + Button: + id: ham_purchase_button + size_hint: (1, 0.25) + text: 'Purchase' + on_press: app.ham_buy() + + BoxLayout: + Label: + font_size:'24sp' + text: 'Money' + + Label: + text: '$'+str(app.money) + + BoxLayout: + Label: + font_size:'24sp' + text: 'Total Price' + + Label: + text: '$'+str(app.total_price) + + BoxLayout: + Button: + text: 'Checkout' + on_press: app.checkout() -- GitLab