From 7d25724decde2267a81298b009ca48801e38fcec Mon Sep 17 00:00:00 2001 From: cbusch864 <cbusch864@hotmail.com> Date: Thu, 26 Jan 2017 18:09:16 -0600 Subject: [PATCH] I have figured out the design and layout of my app, yet I have a bug trying to get the extra charge of bacon to the final price. I think it needs me to call the function for the checkbox for bacon, but I am not positive. --- main.py | 18 +++++++++++--- order.kv | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index da72251..096e12f 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.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,8 +10,19 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l class OrderApp(App): + original_price = NumericProperty(12.99) + bacon = BooleanProperty(False) + extra = NumericProperty(2.99) + total = NumericProperty(12.99) + def build(self): - inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). + inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). + + def update_total_charge(self): + if self.root.id.bacon(False): + self.total = self.original_price + elif self.root.id.bacon(True): + self.total = self.original_price + self.self.extra if __name__ == '__main__': diff --git a/order.kv b/order.kv index d23f974..6583c9b 100644 --- a/order.kv +++ b/order.kv @@ -1,4 +1,75 @@ BoxLayout: orientation: 'vertical' Label: - text: '[Your meal-ordering GUI here]' + text: 'Steak-Stop' + font_size: '40sp' + size_hint: (1,.1) + BoxLayout: + orientation: 'vertical' + BoxLayout: + size_hint: (1,.3) + Label: + text: 'Menu' + BoxLayout: + orientation: 'vertical' + Button: + text: 'Rib-eye' + size_hint: (1,.1) + Button: + text: 'T-Bone' + size_hint: (1,.1) + Button: + text: 'Fillet' + size_hint: (1,.1) + Button: + text: 'Prime rump' + size_hint: (1,.1) + Button: + text: 'flat-iron' + size_hint: (1,.1) + BoxLayout: + orientation: 'horizontal' + Label: + text: 'rare' + font_size: '32sp' + Slider: + id: cook_time + range:(0,100) + value: 50 + Label: + text: 'Well-done' + font_size: '32sp' + BoxLayout: + orientation: 'horizontal' + CheckBox: + font_size: '25sp' + CheckBox: + id: bacon + font_size: '25sp' + CheckBox: + font_size: '25sp' + CheckBox: + font_size: '25sp' + BoxLayout: + orientation: 'horizontal' + Label: + text: 'steak sauce' + font_size: '15sp' + Label: + text: 'Bacon strip around steak' + font_size: '15sp' + Label: + text: 'Barbeque sauce' + font_size: '15sp' + Label: + text: 'peppercorn sauce' + font_size: '15sp' + BoxLayout: + orientation: 'vertical' + CheckBox: + text: 'idk' + font_size: '25sp' + Label: + text: 'Steak price' + str(app.total) + size_hint: (.25,1) + font_size: '20sp' -- GitLab