From e6f7038dfc07db534ba9b2fe3f51c811a1be4d82 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Jahnke <benjahnke@live.com> Date: Wed, 25 Jan 2017 10:02:13 -0600 Subject: [PATCH] Finished Ice Cream Ordering App. --- main.py | 33 ++++++++++++++++++++++++++++- order.kv | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index da72251..6f3ab2c 100644 --- a/main.py +++ b/main.py @@ -1,6 +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 BooleanProperty, NumericProperty __app_package__ = 'edu.unl.cse.soft161.order' __app__ = 'Order Meal' @@ -9,9 +10,39 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l class OrderApp(App): + vanilla = NumericProperty(0.50) + cherry = NumericProperty(1.50) + chocolate = NumericProperty(1.00) + strawberry = NumericProperty(1.00) + oreo = NumericProperty(1.50) + cookie_dough = NumericProperty(1.50) + rocky_road = NumericProperty(1.50) + marshmallow = NumericProperty(1.50) + mint_chip = NumericProperty(1.50) + subtotal = NumericProperty(0.00) + def build(self): inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). - + def addvanilla(self): + self.subtotal += self.vanilla + def addcherry(self): + self.subtotal += self.cherry + def addchocolate(self): + self.subtotal += self.chocolate + def addstrawberry(self): + self.subtotal += self.strawberry + def addoreo(self): + self.subtotal += self.oreo + def addcookie_dough(self): + self.subtotal += self.cookie_dough + def addmarshmallow(self): + self.subtotal += self.marshmallow + def addrocky_road(self): + self.subtotal += self.rocky_road + def addmint_chip(self): + self.subtotal += self.mint_chip + def new_order(self): + self.subtotal = 0 if __name__ == '__main__': app = OrderApp() diff --git a/order.kv b/order.kv index d23f974..d959381 100644 --- a/order.kv +++ b/order.kv @@ -1,4 +1,63 @@ BoxLayout: orientation: 'vertical' - Label: - text: '[Your meal-ordering GUI here]' + BoxLayout: + orientation: 'horizontal' + BoxLayout: + orientation: 'vertical' + Label: + text: "Welcome to Benny's Ice Cream" + font_size: '50sp' + Label: + text: 'Order Personalized Scooped Cones Here' + font_size: '25sp' + BoxLayout: + orientation: 'horizontal' + BoxLayout: + orientation: 'vertical' + Button: + text: 'one scoop of vanilla' + on_press: app.addvanilla() + Button: + text: 'one scoop of cherry' + on_press: app.addcherry() + Button: + text: 'one scoop of chocolate' + on_press: app.addchocolate() + BoxLayout: + orientation: 'vertical' + Button: + text: 'one scoop of strawberry' + on_press: app.addstrawberry() + Button: + text: 'one scoop of cookie dough' + on_press: app.addcookie_dough() + Button: + text: 'one scoop of oreo' + on_press: app.addoreo() + BoxLayout: + orientation: 'vertical' + Button: + text: 'one scoop of marshmallow' + on_press: app.addmarshmallow() + Button: + text: 'one scoop of rocky road' + on_press: app.addrocky_road() + Button: + text: 'one scoop of mint chip' + on_press: app.addmint_chip() + + BoxLayout: + orientation: 'horizontal' + Label: + id: subtotal + font_size: '40sp' + text: 'Subtotal is: $' + format((app.subtotal), '.2f') + BoxLayout: + orientation: 'horizontal' + Button: + id: new_order + size_hint: (.25, 1) + font_size: '20sp' + text: 'New Order' + on_press: app.new_order() + -- GitLab