Commit d03683c3 authored by Ethan Penn's avatar Ethan Penn
Browse files

Final commit for the Order App due Friday

parent 1f0ddda5
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'
......@@ -9,9 +10,34 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l
class OrderApp(App):
total = NumericProperty(0.00)
def build(self):
inspector.create_inspector(Window, self) # For inspection (press control-e to toggle).
def update_total(self):
self.total = 0.00
if self.root.ids.spaghetti.active:
self.total += 4.99
if self.root.ids.penne_mostaccioli.active:
self.total += 9000.01
if self.root.ids.angel_hair.active:
self.total += 0.01
if self.root.ids.bow_tie.active:
self.total += 2.99
if self.root.ids.meat.active:
self.total += 3.48
if self.root.ids.marinara.active:
self.total += 2.07
if self.root.ids.alfredo.active:
self.total += 6.66
if __name__ == '__main__':
app = OrderApp()
......
BoxLayout:
orientation: 'vertical'
Label:
text: '[Your meal-ordering GUI here]'
text: 'Pastaeria'
size_hint: (1,0.1)
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Pasta'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Spaghetti'
CheckBox:
id: spaghetti
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Penne Mostaccioli'
CheckBox:
id: penne_mostaccioli
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Angel Hair'
CheckBox:
id: angel_hair
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Bow Tie'
CheckBox:
id: bow_tie
on_active: app.update_total()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Sauce'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Meat'
CheckBox:
id: meat
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Marinara'
CheckBox:
id: marinara
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Alfredo'
CheckBox:
id: alfredo
on_active: app.update_total()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Total: ' + str(app.total)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment